From bf101b3b26d6b711b5ede6208b136c34f5c4c527 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 21 Oct 2023 21:21:52 +0200 Subject: [PATCH] fixed --- web/inc/classes/Page.class.php | 14 ++++---------- web/pages/login/controller.php | 5 ----- web/templates/mainpage.html | 2 +- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/web/inc/classes/Page.class.php b/web/inc/classes/Page.class.php index 2307823..369d36e 100644 --- a/web/inc/classes/Page.class.php +++ b/web/inc/classes/Page.class.php @@ -94,20 +94,14 @@ class Page function renderPagecontent() { $controller_dir = ROOT . DS . 'pages' . DS . $this->_controller . DS; - /*$partials = []; - if(is_dir($controller_dir.'partials')) - $partials[] = new Mustache_Loader_FilesystemLoader($controller_dir.'partials'); - $partials[] = new Mustache_Loader_FilesystemLoader(ROOT.DS.DS.'templates'.DS.'partials'); - $m = new Mustache_Engine(array( - 'entity_flags' => ENT_QUOTES, - 'partials_loader' => new Mustache_Loader_CascadingLoader($partials) - )); - $this->variables['translate'] = function($value) { return translate($value); }; - $m = $this->addHelpers($m);*/ + //when the template path starts with a / it is relative to the root of the project + if($this->variables['template'][0]=='/') + $this->variables['template'] = '../../'.$this->variables['template']; if($this->variables['template'] && file_exists(ROOT . DS . 'pages' . DS . $this->_controller . DS . $this->variables['template'])) $templatefile = ROOT . DS . 'pages' . DS . $this->_controller . DS . $this->variables['template']; + //render template by running include ob_start(); extract($this->variables); diff --git a/web/pages/login/controller.php b/web/pages/login/controller.php index d5ad8d1..59d68af 100644 --- a/web/pages/login/controller.php +++ b/web/pages/login/controller.php @@ -9,9 +9,4 @@ class Login extends Page { //return print_r($_REQUEST, true); } - function maySeeThisPage() - { - return true; - } - } \ No newline at end of file diff --git a/web/templates/mainpage.html b/web/templates/mainpage.html index a75a899..367338a 100644 --- a/web/templates/mainpage.html +++ b/web/templates/mainpage.html @@ -33,7 +33,7 @@ Features