开发者

Zend Route in a route

In my bootstrap file, I have a heck of a lot of routes. Is there a way to use a previous route as part of a new route?

For example, if I want to change the url structure of route 'admin', instead of changing it 30 times for all the other routes, can I just include the route 'admin' in front of everything else? Something like:

$router->addRoute(
    'admin',
    new Zend_Controller_Router_Route('/admin',
    array('controller' => 'index',
        'action'    => 'index',
        'module'    => 'default')
    )
    ->addRoute(
    'adminPage',
    new Zend_Controller_Router_Route($router->getRoute('admin') . '/somepage',
    array('controller' => 'index',
        'action'    => 'somepage',
开发者_如何学Go        'module'    => 'default')
    );


You should use route chaining.

I use it a lot, very powerful ...

Zend Controller Router - Chains

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜