@ -8,13 +8,12 @@ class ThemeEngine
public $loader;
public $loader;
public $twig;
public $twig;
public function __construct(string $themePath, string $themeAssetPath )
public function __construct(string $themePath)
{
{
$var = [];
$var = [];
$this->themePath = $themePath;
$this->themePath = $themePath;
$this->themeAssetPath = $themeAssetPath;
//$path = explode('/', $themeAssetPath);
$path = explode('/', $themeAssetPath);
//$this->themeFolder = $path[4];
$this->themeFolder = $path[4];
$this->settings = json_decode(
$this->settings = json_decode(
file_get_contents('./data/settings.json'),
file_get_contents('./data/settings.json'),
true
true
@ -25,7 +24,7 @@ class ThemeEngine
true
true
);
);
$this->loader = new \Twig\Loader\FilesystemLoader(
$this->loader = new \Twig\Loader\FilesystemLoader(
$themePath . '/' . $path[4]
$themePath . '/'
);
);
$this->twig = new \Twig\Environment($this->loader, []);
$this->twig = new \Twig\Environment($this->loader, []);
$this->router($_SERVER['REQUEST_URI']);
$this->router($_SERVER['REQUEST_URI']);
@ -36,7 +35,7 @@ class ThemeEngine
$pageInfo = [
$pageInfo = [
'keywords' => $this->settings['keywords'],
'keywords' => $this->settings['keywords'],
'description' => $this->settings['description'],
'description' => $this->settings['description'],
'image' => $this->themeAsset Path . '/assets/images/global/default-bg.jpg',
'image' => $this->themePath . '/assets/images/global/default-bg.jpg',
];
];
$featureList = explode(',', $this->posts['feature']);
$featureList = explode(',', $this->posts['feature']);
@ -70,10 +69,10 @@ class ThemeEngine
$pageOptions = [
$pageOptions = [
'debug' => true, // for theme kit
'debug' => true, // for theme kit
'theme' => $this->themeFolder , // for theme kit
'theme' => $this->themePath , // for theme kit
'title' => 'This is Fipamo',
'title' => 'This is Fipamo',
'dynamicRender' => $this->settings['dynamicRender'],
'dynamicRender' => $this->settings['dynamicRender'],
'background' => $this->themeAsset Path . '/assets/images/global/default-bg.jpg',
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
'recent' => $recent,
'recent' => $recent,
'featured' => $featured,
'featured' => $featured,
'info' => $pageInfo,
'info' => $pageInfo,
@ -89,10 +88,10 @@ class ThemeEngine
$template = $request . '.twig';
$template = $request . '.twig';
$pageOptions = [
$pageOptions = [
'debug' => true, // for theme kit
'debug' => true, // for theme kit
'theme' => $this->themeFolder , // for theme kit
'theme' => $this->themePath , // for theme kit
'title' => 'Page Title',
'title' => 'Page Title',
'dynamicRender' => $this->settings['dynamicRender'],
'dynamicRender' => $this->settings['dynamicRender'],
'background' => $this->themeAsset Path . '/assets/images/global/default-bg.jpg',
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
'content' => $content,
'content' => $content,
'meta' => $meta,
'meta' => $meta,
'info' => $pageInfo,
'info' => $pageInfo,
@ -106,10 +105,10 @@ class ThemeEngine
$template = 'tags.twig';
$template = 'tags.twig';
$pageOptions = [
$pageOptions = [
'debug' => true, // for theme kit
'debug' => true, // for theme kit
'theme' => $this->themeFolder , // for theme kit
'theme' => $this->themePath , // for theme kit
'title' => 'Pages Tagged as Tag',
'title' => 'Pages Tagged as Tag',
'dynamicRender' => $this->settings['dynamicRender'],
'dynamicRender' => $this->settings['dynamicRender'],
'background' => $this->themeAsset Path . '/assets/images/global/default-bg.jpg',
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
'tag_list' => $tags,
'tag_list' => $tags,
'info' => $pageInfo,
'info' => $pageInfo,
'menu' => $menu,
'menu' => $menu,
@ -120,10 +119,10 @@ class ThemeEngine
$template = 'archive.twig';
$template = 'archive.twig';
$pageOptions = [
$pageOptions = [
'debug' => true, // for theme kit
'debug' => true, // for theme kit
'theme' => $this->themeFolder , // for theme kit
'theme' => $this->themePath , // for theme kit
'title' => 'Archive',
'title' => 'Archive',
'dynamicRender' => $this->settings['dynamicRender'],
'dynamicRender' => $this->settings['dynamicRender'],
'background' => $this->themeAsset Path . '/assets/images/global/default-bg.jpg',
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
'archives' => $archive['archives'],
'archives' => $archive['archives'],
'info' => $pageInfo,
'info' => $pageInfo,
'menu' => $menu,
'menu' => $menu,
@ -137,10 +136,10 @@ class ThemeEngine
$template = 'error.twig';
$template = 'error.twig';
$pageOptions = [
$pageOptions = [
'debug' => true, // for theme kit
'debug' => true, // for theme kit
'theme' => $this->themeFolder , // for theme kit
'theme' => $this->themePath , // for theme kit
'title' => 'Uh oh',
'title' => 'Uh oh',
'dynamicRender' => $this->settings['dynamicRender'],
'dynamicRender' => $this->settings['dynamicRender'],
'background' => $this->themeAsset Path . '/assets/images/global/default-bg.jpg',
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
'info' => $pageInfo,
'info' => $pageInfo,
'content' => "This page is not defined",
'content' => "This page is not defined",
'menu' => $menu,
'menu' => $menu,