2012-04-02 67 views
0

我想航线从控制器到自定义路由路由到Custome航线

我做一个自定义路由

$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); 

,我想从控制器到 索引页让rediorection我作出这样,但它不起作用

$this->_helper->redirector->gotoRoute(array('module' => 'blogs', 'controller' => 'blog', 'action' => 'index', 'blog_id' => $this->blog_id)); 
+1

尝试此:$这 - > _ helper-> redirector-> gotoRoute(阵列( 'blog_id'=> $这个 - > blog_id), '博客'); – 2012-04-02 08:03:20

回答

3

您没有传递路由的名称作为构建url的gotoRoute方法的第二个参数。

所以代码应该像

$this->_helper->redirector->gotoRoute(array('module' => 'blogs', 'controller' => 'blog', 'action' => 'index', 'blog_id' => $this->blog_id),'blogs')