コード例 #1
0
ファイル: Bootstrap.php プロジェクト: hartum/basezf
 protected function _initFrontController()
 {
     // init standart router
     $router = new Zend_Controller_Router_Rewrite();
     // init dispatcher with modules controllers
     $dispatcher = new Zend_Controller_Dispatcher_Standard();
     // init controllers modules
     $controllerModules = array();
     foreach ($this->_controllerModules as $controllerModule) {
         $controllerModules[strtolower($controllerModule)] = PATH_TO_CONTROLLERS . '/' . ucfirst(strtolower($controllerModule));
     }
     $dispatcher->setControllerDirectory($controllerModules);
     // init front controller
     $frontController = Zend_Controller_Front::getInstance();
     $frontController->setRouter($router)->setDispatcher($dispatcher);
     // init routes
     $routes = $this->_getRoutes();
     foreach ($routes as $name => &$route) {
         $router->addRoute($name, $route);
     }
 }