开发者

Zend router problem

folks. I have some problems with zend routes I have shops controller. It has 3 actions(for now):

  • index - lists all of shops using paginator(so I have /shops/?page=2)
  • show - shows concrete shop (show/Apple+store)
  • search - shows search form

So now I need to make routing for that. I have followin routes

  • 'shop', new Zend_Controller_Router_Route ('/shops/:title',array('controller' => 'shops', 'action' => 'show'),array('title开发者_Python百科' => '/^(?!search$).+$/'))

  • 'search_shops',new Zend_Controller_Router_Route_Static ('/shop/search',array('controller' => 'shops', 'action' => 'show'))

but when i try to go /shops/Apple+store it says, that there is no Apple store action. If I ommit regexp part on shop route, I can't go to search.

What am I doing wrong?


Just omit the slashes in the regular expression, i.e.

new Zend_Controller_Router_Route ('/shops/:title',array('controller' => 'shops', 'action' => 'show'),array('title' => '^(?!search$).+$'))

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜