From d69615b8ad812582474ecd8650248e5df48f716a Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 5 Mar 2018 00:41:00 +0300 Subject: [PATCH] #431 general structure changes --- monstra/Monstra.php | 4 ++-- monstra/Page.php | 16 ++++++++++++++++ monstra/Themes.php | 16 ---------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/monstra/Monstra.php b/monstra/Monstra.php index 71b153c..5fdd8ad 100755 --- a/monstra/Monstra.php +++ b/monstra/Monstra.php @@ -77,7 +77,6 @@ class Monstra extends Container return new Pages($c); }; - $container['themes'] = function ($c) { return new Themes($c); }; @@ -104,7 +103,8 @@ class Monstra extends Container // Set default timezone date_default_timezone_set($this['config']->get('site.timezone')); - $this['themes']->renderTemplate($this['pages']->getPage(\Url::getUriString())); + // Render page + $this['pages']->renderPage($this['pages']->getPage(\Url::getUriString())); // Flush (send) the output buffer and turn off output buffering ob_end_flush(); diff --git a/monstra/Page.php b/monstra/Page.php index 17e69a9..bc8ea29 100755 --- a/monstra/Page.php +++ b/monstra/Page.php @@ -98,6 +98,22 @@ class Page return $file; } + /** + * Render page + */ + public function renderPage($page) + { + if (empty($page['template'])) { + $template_name = 'index'; + } else { + $template_name = $page['template']; + } + + $template_ext = '.php'; + + include THEMES_PATH . '/' . $this->monstra['config']->get('site.theme') . '/' . $template_name . $template_ext; + } + /** * Page parser */ diff --git a/monstra/Themes.php b/monstra/Themes.php index 07ac509..d884c10 100644 --- a/monstra/Themes.php +++ b/monstra/Themes.php @@ -1,9 +1,6 @@ monstra = $c; } - public function renderTemplate($page) - { - if (empty($page['template'])) { - $template_name = 'index'; - } else { - $template_name = $page['template']; - } - - $template_ext = '.php'; - - include THEMES_PATH . '/' . $this->monstra['config']->get('site.theme') . '/' . $template_name . $template_ext; - } - }