/** * @param $controller * @param $view */ public function render($controller, $view) { $this->controllers = get_class($controller); if (file_exists(VIEW . 'header.php')) { require_once VIEW . 'header.php'; } else { $Ex = new Exception(); $Ex->notHeader(); } if (file_exists(VIEW . $this->controllers . '/' . $view . '.phtml')) { require_once VIEW . $this->controllers . '/' . $view . '.phtml'; } else { $Ex = new Exception(); $Ex->notIndex(); } if (file_exists(VIEW . 'footer.php')) { require_once VIEW . 'footer.php'; } else { $Ex = new Exception(); $Ex->notFooter(); } }
/** * Load an existing controller if there IS a GET parameter passed * * @return boolean|string */ private function _loadExistsController() { $this->_controllerPath .= $this->_controller . '.php'; if (file_exists($this->_controllerPath)) { require_once $this->_controllerPath; if (class_exists($this->_controller)) { $this->_controller = new $this->_controller(); } else { Exception::Controller($this->_controllerPath); } } else { Exception::createController($this->_controller); } if (isset($this->method)) { if (method_exists($this->_controller, $this->method)) { if (isset($this->parems)) { call_user_func(array($this->_controller, $this->method), $this->parems); } else { call_user_func(array($this->_controller, $this->method)); } } else { // $this->_controller->index($this->parems); try { $this->_controller->index($this->parems); } catch (Exception $ex) { Exception::indexController($this->_controllerPath); } // } } else { } }
/** * Get the code surrounding the line where the exception occurred. * * @return array */ public function context() { return File::snapshot($this->exception->getFile(), $this->exception->getLine()); }