Reputation: 9848
I want to route from controller to custom route
I make a custom route
$reportRoute = new Zend_Controller_Router_Route('blogs/blog_id/:blog_id', array('module' => 'blogs', 'controller' => 'blog', 'action' => 'index','blog_id' =>NULL));
$routesArray = array('blogs' => $reportRoute);
$router->addRoutes($routesArray);
and I want to make rediorection from controller to index page I make like this, but it doesn't work
$this->_helper->redirector->gotoRoute(array('module' => 'blogs', 'controller' => 'blog', 'action' => 'index', 'blog_id' => $this->blog_id));
Upvotes: 0
Views: 886
Reputation: 8186
you are not passing the name of route as the second argument for gotoRoute method to build url.
So code should be like
$this->_helper->redirector->gotoRoute(array('module' => 'blogs', 'controller' => 'blog', 'action' => 'index', 'blog_id' => $this->blog_id),'blogs')
Upvotes: 3