When a page is not found, from now on the router sends the function in the parameters so the not_found function can handle dynamic requests

This commit is contained in:
Abel Hoogeveen 2015-02-24 14:54:34 +01:00
parent 455dbd0c97
commit 8a320bbe3e
1 changed files with 6 additions and 3 deletions

View File

@ -98,9 +98,6 @@ class Router extends Bus {
/**
* Load a controller
* @access public
* @param String controller name
* @param String function name
* @param Array Parameters
*/
public function loadController() {
$file = $this->directory . "controller.".strtolower($this->controllerName).".php";
@ -118,6 +115,9 @@ class Router extends Bus {
} elseif (method_exists($this->controller, 'not_found')) {
// Trying last resort
$this->logger->log("Function was not found, trying Controllers not_found function");
// Add the function to the parameters just because it's usefull
array_unshift($this->parameters, $this->function);
$this->controller->not_found($this->parameters);
} else {
$this->logger->logError("Could not load not_found function. Aborting");
@ -130,6 +130,9 @@ class Router extends Bus {
require_once($file);
$this->controllerClass = ucfirst($this->config->main->default_controller);
$this->controller = new $this->controllerClass($this->core);
// Add the function to the parameters just because it's usefull
array_unshift($this->parameters, $this->function);
$this->controller->not_found($this->parameters);
}
}