|
|
|
@ -7,12 +7,14 @@ class ThemeEngine
|
|
|
|
|
public $data = [];
|
|
|
|
|
public $loader;
|
|
|
|
|
public $twig;
|
|
|
|
|
public function __construct()
|
|
|
|
|
public function __construct(string $themePath, string $themeAssetPath)
|
|
|
|
|
{
|
|
|
|
|
$this->themePath = $themePath;
|
|
|
|
|
$this->themeAssetPath = $themeAssetPath;
|
|
|
|
|
$path = explode("/", $themeAssetPath);
|
|
|
|
|
$this->themeFolder = $path[4];
|
|
|
|
|
$this->data = json_decode(file_get_contents("./config.json"), true);
|
|
|
|
|
$this->loader = new \Twig\Loader\FilesystemLoader(
|
|
|
|
|
"src/themes/theme-fipamo-default/"
|
|
|
|
|
);
|
|
|
|
|
$this->loader = new \Twig\Loader\FilesystemLoader($themePath);
|
|
|
|
|
$this->twig = new \Twig\Environment($this->loader, []);
|
|
|
|
|
$this->router($_SERVER["REQUEST_URI"]);
|
|
|
|
|
}
|
|
|
|
@ -22,8 +24,7 @@ class ThemeEngine
|
|
|
|
|
$pageInfo = [
|
|
|
|
|
"keywords" => $this->data["keywords"],
|
|
|
|
|
"description" => $this->data["description"],
|
|
|
|
|
"image" =>
|
|
|
|
|
"/src/themes/theme-fipamo-default/fipamo-default/assets/images/global/default-bg.jpg",
|
|
|
|
|
"image" => $this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$menu = $this->data["menu"];
|
|
|
|
@ -31,13 +32,13 @@ class ThemeEngine
|
|
|
|
|
case "/":
|
|
|
|
|
$recent = $this->data["recent_posts"];
|
|
|
|
|
$featured = $this->data["featured_posts"];
|
|
|
|
|
$template = "fipamo-default/index.twig";
|
|
|
|
|
$template = $this->themeFolder . "/index.twig";
|
|
|
|
|
|
|
|
|
|
$pageOptions = [
|
|
|
|
|
"debug" => true,
|
|
|
|
|
"title" => "This is Fipamo",
|
|
|
|
|
"background" =>
|
|
|
|
|
"/src/themes/theme-fipamo-default/fipamo-default/assets/images/global/default-bg.jpg",
|
|
|
|
|
$this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
|
|
|
|
"recent" => $recent,
|
|
|
|
|
"featured" => $featured,
|
|
|
|
|
"info" => $pageInfo,
|
|
|
|
@ -47,12 +48,12 @@ class ThemeEngine
|
|
|
|
|
case "/page":
|
|
|
|
|
$content = $this->data["content"];
|
|
|
|
|
$meta = $this->data["meta"];
|
|
|
|
|
$template = "fipamo-default/page.twig";
|
|
|
|
|
$template = $this->themeFolder . "/page.twig";
|
|
|
|
|
$pageOptions = [
|
|
|
|
|
"debug" => true,
|
|
|
|
|
"title" => "Page Title",
|
|
|
|
|
"background" =>
|
|
|
|
|
"/src/themes/theme-fipamo-default/fipamo-default/assets/images/global/default-bg.jpg",
|
|
|
|
|
$this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
|
|
|
|
"content" => $content,
|
|
|
|
|
"meta" => $meta,
|
|
|
|
|
"info" => $pageInfo,
|
|
|
|
@ -61,12 +62,12 @@ class ThemeEngine
|
|
|
|
|
break;
|
|
|
|
|
case "/tags":
|
|
|
|
|
$tags = $this->data["tag_list"];
|
|
|
|
|
$template = "fipamo-default/tags.twig";
|
|
|
|
|
$template = $this->themeFolder . "/tags.twig";
|
|
|
|
|
$pageOptions = [
|
|
|
|
|
"debug" => true,
|
|
|
|
|
"title" => "Pages Tagged as Tag",
|
|
|
|
|
"background" =>
|
|
|
|
|
"/src/themes/theme-fipamo-default/fipamo-default/assets/images/global/default-bg.jpg",
|
|
|
|
|
$this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
|
|
|
|
"tag_list" => $tags,
|
|
|
|
|
"info" => $pageInfo,
|
|
|
|
|
"menu" => $menu,
|
|
|
|
@ -74,12 +75,12 @@ class ThemeEngine
|
|
|
|
|
break;
|
|
|
|
|
case "/archive":
|
|
|
|
|
$archive = $this->data["archives"];
|
|
|
|
|
$template = "fipamo-default/archive.twig";
|
|
|
|
|
$template = $this->themeFolder . "/archive.twig";
|
|
|
|
|
$pageOptions = [
|
|
|
|
|
"debug" => true,
|
|
|
|
|
"title" => "Archive",
|
|
|
|
|
"background" =>
|
|
|
|
|
"/src/themes/theme-fipamo-default/fipamo-default/assets/images/global/default-bg.jpg",
|
|
|
|
|
$this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
|
|
|
|
"archives" => $archive,
|
|
|
|
|
"info" => $pageInfo,
|
|
|
|
|
"menu" => $menu,
|
|
|
|
@ -95,4 +96,7 @@ class ThemeEngine
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new ThemeEngine();
|
|
|
|
|
new ThemeEngine(
|
|
|
|
|
"src/themes/theme-fipamo-default",
|
|
|
|
|
"/src/themes/theme-fipamo-default/fipamo-default"
|
|
|
|
|
);
|
|
|
|
|