开发者

In Zend MVC, how do you add a view for a page in a subpath?

开发者 https://www.devze.com 2023-02-09 08:31 出处:网络
/controller/action but what if we have /controller/action/subaction How do you add this \"subaction\" to c开发者_如何学Controller?There are no sub-actions in an MVC design.

/controller/action

but what if we have

/controller/action/subaction

How do you add this "subaction" to c开发者_如何学Controller?


There are no sub-actions in an MVC design.

What you can do is set "subaction" as a parameter or argument to the action. If you don't want to use the default param/value pairing, you would need to set up a custom route to recognise a single value.

To choose a different view, you use the ViewRenderer action helper. See ZEND, rendering different view with data


you can create Facades somewhere else, then write mod_rewrite to redirect all ^/controller/.* URLs to /controller/ and redirect all requests in init() method to correspondent method in Facade

you can also try to create something like YourController that extends Zend_Controller_Action, and modify all controllers to extend that controller

0

精彩评论

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