将值传递给 Zend Framework 中的布局.....? [英] Passing values to the Layout in Zend Framework.....?
问题描述
我在 zend-framework
中遇到了一个与 layout
相关的问题.在这里,我必须将一些值
传递给layout
,用于显示网站的排名靠前的用户
.
I am facing a problem in zend-framework
related to layout
. Here I have to pass some values
to the layout
that will be used to display the top-ranking users
of the site.
由于我是 Zend-framework 的新手,我无法找到任何方法.
Since I am new to zend-framework, I'm not able to find any way to do so.
如果您有任何代码、想法或链接,请提供给我......
If you have any code, idea or link, please provide me.....
提前致谢...........
Thanks in advance...........
推荐答案
创建一个控制器插件,在呈现布局之前随时获取此数据并将数据传递给视图.然后在 layout.phtml 上渲染该数据,就像渲染任何其他数据一样,例如使用 ViewHelper 或 Partial.
Create a Controller Plugin that fetches this data anytime before the layout is rendered and pass the data to to the view. Then render that data on your layout.phtml like you would render any other data, e.g. use a ViewHelper or a Partial.
参见 http://zendframework.com/manual/en/zend.controller.plugins.html
或使用操作助手,如
这篇关于将值传递给 Zend Framework 中的布局.....?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!