如何在Zend Framework中实现侧边栏 [英] How to implement a sidebar in Zend Framework
问题描述
如何在Zend Framework中实现侧边栏? 我知道我可以在Zend_layout中使用占位符或类似的东西,但是如何在控制器中自动为边栏生成代码,而不必在每个控制器中调用边栏类? 我的设置如下
How do I implement a sidebar in Zend Framework? I know that I can use a placeholder or something similar in Zend_layout, but how do I automatically generate the code for the sidebar in my controllers without having to call a sidebar class within every controller? My setup is as follows
Application
- modules
- blog
- other modules
我只想要博客模块的侧边栏.
I only want the sidebar for my blog module.
I have found this http://www.zfforums.com/zend-framework-components-13/model-view-controller-mvc-21/how-layout-sidebar-etc-2677.html but I do not understand the last part "just inject your layout, register it with the front controller ..."
推荐答案
您可以在其中一个呈现侧边栏的控制器中进行操作并查看.
You could just have a action and view in one of your controllers which renders the sidebar.
您刚刚调用的博客模块的布局中:
from the layout for the blog module you just call:
<? echo $this->action('action','controller','module',array('optionalparams'=>1); ?>
在您想要的位置上.因此,一次调用一个动作.
on the position where you want to have it. So one call to one action.
这篇关于如何在Zend Framework中实现侧边栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!