/** * xxx todo: error handling */ function route() { $actionParam = _get("action"); $paramParts = explode("!", $actionParam); $controller = $paramParts[0]; $action = $paramParts[1]; $controllerDir = controller_dir($controller); $controllerFile = $controllerDir . "/controller.php"; require_once $controllerFile; $controllerClassName = "Controller_{$controller}"; $controllerInstance = new $controllerClassName(); $actionRouter = new ActionRouter($controllerInstance, $action, $controllerDir); $actionRouter->route(); }
/** * Constructor allows a rewriting pattern to be specified * * @param string $format sprintf compatible format */ public function __construct($format = "%s.%s.page?%s", $mode = UrlWriterMode::WEB, $appRoot = '', $defaultRoute = '') { self::$_format = $format; $this->_mode = $mode; $this->_appRoot = $appRoot; $this->_defaultRoute = $defaultRoute; }