开发者

Zend Naviation Menu View Helper - All links are the same?

开发者 https://www.devze.com 2023-01-14 06:21 出处:网络
heres my setup: http://www.example.com/<module>/<controller>/<action> I have this route defined:

heres my setup:

http://www.example.com/<module>/<controller>/<action>

I have this route defined:

$router->addRoute(
            'editUser', new Zend_Controller_Router_Route('admin/users/edit/:id',
                array(
                    'module'     => 'admin',
                    'controller' => 'users',
                    'a开发者_高级运维ction'     => 'edit',
                    'route'      => 'default',
                    'id'         => 0,
                ),
                array('id' => '\d+')
            )
        );

So my sites navigation menu works fine until i go to a page like so:

http://www.example.com/admin/users/edit/10

It displays the page no problem but now every link in the navigation menu points to http://www.example.com/admin/users/edit

Not sure why this is happening and would like to get it fixed while maintaining use of the router.

Thanks in advance for any pointers!


It's a common problem.

If you are using custom routes in your navigation (editUser in your case) you must explicitly pass 'default' route to Zend_Navigation pages and url() view helpers.

0

精彩评论

暂无评论...
验证码 换一张
取 消