我正在使用“模块”前端控制器资源进行项目设置。
渲染站点范围元素(例如导航)的最佳方法是什么?
- Add the action which renders the element to the end of the action stack each request?
- Create a plugin which renders the element?
- 还有其他可能的方法吗?
我认为应该避免操作堆栈。请参阅这篇文章了解原因 http://www.rmauger.co.uk/2009/03/why-the-zend-framework-actionstack-is-evil/.
插件方法可以工作,或者您可以创建从布局脚本调用的 ViewHelpers。我喜欢 ViewHelpers 方法,因为它使一切都非常清晰。您知道,当您回显 $this->mainNaviation() 时,有一个名为 MainNavigation 的 ViewHelper。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)