You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FipamoThemeKit/index.php

46 lines
1.0 KiB
PHP

<?php
require "vendor/autoload.php";
class ThemeEngine
{
public $data = [];
public $loader;
public $twig;
public function __construct()
{
$this->data = json_decode(file_get_contents("./config.json"), true);
$this->loader = new \Twig\Loader\FilesystemLoader("src/themes/");
$this->twig = new \Twig\Environment($this->loader, []);
$this->router($_SERVER["REQUEST_URI"]);
}
public function router(string $request)
{
switch ($request) {
case "/":
echo "this is the index";
break;
case "":
require __DIR__ . "/views/index.php";
break;
case "/archive":
$archive = $this->data["archives"];
echo $this->twig->render(
"theme-fipamo-default/fipamo-default/archive.twig",
[
"title" => "Archive",
"archives" => $archive,
]
);
break;
default:
http_response_code(404);
require __DIR__ . "/views/404.php";
break;
}
}
}
new ThemeEngine();