dispatchLoopStartup happens after routing so the route you add is
never really there.

use routeStartup

2009/1/12 Michel Morelli <mic...@ziobuddalabs.it>:
> Hi all. I'm creating a web site, and I have split the site in more modules.
> One for the frontend, one for the admin, one for the user, etc etc.
>
> Now I have a problem while setting Layout.
>
> This is my code (in a plugin):
>
> public function dispatchLoopStartup(Zend_Controller_Request_Abstract
> $request) {
>
>          $viewRenderer =
> Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
>       $viewRenderer->init();
>       $view = $viewRenderer->view;
>
>
>       //-- START --
>       $frontController = Zend_Controller_Front::getInstance();
>
>       $routes = array();
>       $routes['user'] = new
> Zend_Controller_Router_Route('user/:controller/:action/*', array('module' =>
> 'user', 'controller' => 'auth', 'action' => 'index'));
>       $router = new Zend_Controller_Router_Rewrite();
>       $router->addRoutes($routes);
>       $frontController->setRouter($router);
>
>       //-- END --
>
>
>       $layout = Zend_Layout::getMvcInstance();
>       $auth = Zend_Auth::getInstance();
>       //$layout->setLayout("layout");
>       //return;
>       if($auth->hasIdentity()) {
>
>           $layout->setLayout('loggedIn');
>
> $view->headLink()->appendStylesheet($view->baseUrl().'/css/style.css');
>       } else {
>           $layout->setLayout("layout");
>
>       }
>
> } //END PLUGIN
>
> Note the piece of code content from START to END. With this code all works,
> but if I comment those lines  Zend Framework give me this error:
>
> Zend_Controller_Router_Exception: Route user is not defined in
> {MY_PATH}/library/ZendFramework-1.7.2-minimal/library/Zend/Controller/Router/Rewrite.php
> on line 250
>
> Why this ? Where is my problem ?
>
> Tnx for all.
>
> M.
>
> --
> Michel 'ZioBudda' Morelli                       mic...@ziobuddalabs.it
> Consulenza sistemistica in ambito OpenSource.
> Sviluppo applicazioni web dinamiche (LAMP+Ajax)
> Telefono: 0200619074
> Telefono Cell: +39-3939890025 --  Fax: +39-0291390660
>
> http://www.ziobudda.net                         ICQ: 58351764
> http://www.ziobuddalabs.it                      Skype: zio_budda
> http://www.ajaxblog.it                                MSN: 
> mic...@ziobuddalabs.it
>                                               JABBER: mic...@gmail.com
>



-- 
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------

Reply via email to