Ejemplo n.º 1
0
 protected static function routeController($uri_parts)
 {
     $limit = count($uri_parts);
     while ($limit && !controllerExists($controller_name = joinControllerName($uri_parts, $limit))) {
         $limit--;
     }
     if (!controllerExists($controller_name)) {
         error404();
     }
     $load_path = array_splice($uri_parts, 0, $limit);
     $command = array_shift($uri_parts);
     self::$_loadPath = $load_path;
     self::$_action = $command;
     loadController($controller_name);
     $controller = new $controller_name();
     self::$_controller = $controller;
     $controller->setLoadPath('/' . implode('/', $load_path));
     $controller->init();
     $controller->doAction($command, $uri_parts);
     self::end();
 }