public function viewExists($ps_path) { if (!$this->opo_view) { $this->initView(); } return $this->opo_view->viewExists($ps_path); }
/** * Runs this route. */ public function run() { // Get the path of the controller script to require $controllerPath = APP_CONTROLLERS_PATH . '/' . $this->controller . '_controller.php'; if (!file_exists($controllerPath)) { $controllerPath = APP_CONTROLLERS_PATH_CORE . '/' . $this->controller . '_controller.php'; } if (!file_exists($controllerPath)) { throw new Exception('Controller does not exist'); } // Pull in the class require_once $controllerPath; // Make sure the controller class exists if (!class_exists($this->controller . '_controller')) { throw new Exception('Controller class does not exist.'); } // Create a new instance of the class $controllerName = $this->controller . '_controller'; $instance = new $controllerName(); // Run the function and get the context $context = $instance->{$this->function}(); if ($context == null) { $context = array(); } // See if a view exists for it, if so let's render it // If one doesn't exist, that's fine, it may just be a POST or GET endpoint if (View::viewExists($this->controller . '/' . $this->function)) { View::renderView($this->controller . '/' . $this->function, $context); } }