ZF:在引导程序中使用路由时链接错误
问题是在视图中生成 Zend_Navigation 菜单时,所有链接都有“/projects/add/”href。 同时,当“/projects/list/”处于活动状态时,所有链接都是正确的。 如果我删除这条路线也是一样 - 所有链接都可以。
因此,虽然“/projects/add/”href 处于活动状态,但问题是。
引导程序的部分代码:
$frontController = Zend_Controller_Front::getInstance();
$router = $frontController->getRouter();
$router->addRoutes(array(
'AddProject' => new Zend_Controller_Router_Route('/projects/add/:key', array('module' => 'default', 'controller' => 'projects', 'action' => 'add', 'key' => '')),
));
The problem is when generating Zend_Navigation menu in the view all links have "/projects/add/" href.
At the same time when "/projects/list/" is active all links are correct.
The same if I deleted this route - all links are ok.
So, while "/projects/add/" href is active the problem is.
Part of code from bootstrap:
$frontController = Zend_Controller_Front::getInstance();
$router = $frontController->getRouter();
$router->addRoutes(array(
'AddProject' => new Zend_Controller_Router_Route('/projects/add/:key', array('module' => 'default', 'controller' => 'projects', 'action' => 'add', 'key' => '')),
));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案我在此处找到了
我刚刚在所有菜单项中添加了默认值以前没有。就是这个...))
Answer I found here
I just added default at all menu items which hadn't before. This is it...))