best approach to render site-wide elements using Zend Framework

霸气de小男生 提交于 2020-01-02 17:46:29

问题


I'm using the 'modules' front controller resource for the project setup. What's the best approach to render site-wide elements, like navigation?

  • Add the action which renders the element to the end of the action stack each request?
    • is it OK to render these elements through controller actions?
  • Create a plugin which renders the element?
    • Could I use module specific plugins?
  • are there other possible ways to do this?

回答1:


I think the action stack should be avoided. See this article for why.

The plugin method could work or you can create ViewHelpers which you call from you layout script. I like the ViewHelpers method because it keeps everything very clear. You know that when you echo out $this->mainNaviation() that there is a ViewHelper called MainNavigation.



来源:https://stackoverflow.com/questions/1558909/best-approach-to-render-site-wide-elements-using-zend-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!