view = new View(); $this->request = $request; if(!empty($request['action']) && $request['action']) { // any action needs to be done? $this->actionController(); } $this->template = !empty(strtok($_SERVER['REQUEST_URI'], '?')) ? strtok($_SERVER['REQUEST_URI'], '?') : 'default'; } /** * Return requested page * * @return String Content of requested page */ public function display() { $singlePage = false; // set to true if header/footer shouldn't be used switch($this->template) { case 'default': default: $singlePage = true; $this->view->setTemplate('default'); $this->view->assign("test", "joo"); break; } if(!$singlePage) { $headerView = new View(); $footerView = new View(); $headerView->setTemplate("header"); $footerView->setTemplate("footer"); $header = $headerView->loadTemplate(); // save them in vars to prevent errors being ignored $footer = $footerView->loadTemplate(); $this->view->assign("errors", ErrorHandler::$eh->getErrors()); // get errors as last thing return $header . $this->view->loadTemplate() . $footer; } $this->view->assign("errors", ErrorHandler::$eh->getErrors()); // get errors as last thing return $this->view->loadTemplate(); } private function actionController() { switch($this->request['action']) { default: error_log("Unknown action: " . $this->request['action']); break; } } } ?>