开发者

Zend Controller all actions to one action

I have categorie Controller, with index action

I need that when I enter address .com/categorie/education it uses i开发者_如何学Cndex action with parameter education .com/categorie/index/education

or redirect all actions to index ??


How are your routes setup? Given the lack of information provided I have to assume that you are using an .ini file, this is how it would work:

; CATEGORIE
categorie.type = "Zend_Controller_Router_Route_Static"
categorie.route = "categorie"
categorie.defaults.controller = categorie
categorie.defaults.action = index

categorie_view.route = "categorie/:slug"
categorie_view.defaults.controller = category
categorie_view.defaults.action = view

Note, I did change it up a bit, as the index action, imo, should list all categories. This way you have a viewAction to list the individual categorie.

To have it as you requested I believe it would be something like:

; CATEGORIE
categorie.route = "categorie/:slug"
categorie.defaults.controller = categorie
categorie.defaults.action = index
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜