diff --git a/rawilum/Page.php b/rawilum/Page.php index ddaecc5c..5d2907c9 100755 --- a/rawilum/Page.php +++ b/rawilum/Page.php @@ -104,10 +104,16 @@ class Page */ public function renderPage($page) { - $template_ext = '.php'; + $template_ext = '.php'; $template_name = empty($page['template']) ? 'index' : $page['template']; + $site_theme = $this->rawilum['config']->get('site.theme'); + $template_path = THEMES_PATH . '/' . $site_theme . '/' . $template_name . $template_ext; - include THEMES_PATH . '/' . $this->rawilum['config']->get('site.theme') . '/' . $template_name . $template_ext; + if ($this->rawilum['filesystem']->exists($template_path)) { + include $template_path; + } else { + throw new RuntimeException("Rawilum site config file does not exist."); + } } /**