Where should I define custom routes in my ZF 1.10 app?

Posted by Ross on Stack Overflow See other posts from Stack Overflow or by Ross
Published on 2010-04-17T15:53:14Z Indexed on 2010/04/17 17:13 UTC
Read the original article Hit count: 218

Filed under:
|
|

With the new Zend_Application/Zend_Application_Bootstrap classes I'm confused as to where I should be applying my custom routes. For example, at the moment I have one route:

protected function _initRouter() {
    $router = new Zend_Controller_Router_Rewrite;
    $route = new Zend_Controller_Router_Route('news/:id', 
        array('controller' => 'news', 'action' => 'view'));
    $router->addRoute('postArchive', $route);           
}

This method is in my Zend_Application_Bootstrap_Bootstrap and is definitely run. The route is also applied in $router.

As I see it I could be doing two things wrong - either the wrong place to add these routes, or not adding to the correct router. Can anyone point me in the right direction with this?

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about routing