如何在Zend Framework中实现侧边栏 [英] How to implement a sidebar in Zend Framework

查看:72
本文介绍了如何在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆