Zend Framework cleaning default routes when adding other

Posted by Renato Aquino on Stack Overflow See other posts from Stack Overflow or by Renato Aquino
Published on 2010-04-26T21:52:15Z Indexed on 2010/04/26 21:53 UTC
Read the original article Hit count: 350

Filed under:
|

I have the following problem with Zend Framework.

My project has several controllers like Video,Category and Post.

The VideoController has an Action called categorylist, so the default URL/Route becomes /video/categorylist

Since the action requires 3 parameters I whant to add one simple route:

$router->addRoute(
        'categorylist',
        new Zend_Controller_Router_Route('categorylist/:category/:page/:per_page', array('controller' => 'video', 'action' => 'categorylist','page'=>1,'per_page'=>6,'category'=>1))
);      

With this I got my URL like www.siteurl.com/categorylist/42/1/6 but, the View Helper URL got crazy, and every url for the other controllers I try to echo it´s redirected to the categorylist route.

So when I try this:

<?= $this->url(array("controller"=> "video", "action" =>"view",'category'=>1),null,true)?>

The expected result its /video/view/category/1, but I got /categorylit only.

I tryied to debug the default routes but I got an empty array.

print_r($ctrl->getRouter()->getRoutes());

Does anyone have some clue about this wierd behavior?

I´m using Zend Framework Version 1.9.7

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about zend-route