Zend Action Helper 与插件 [英] Zend Action Helper Versus Plugin

查看:22
本文介绍了Zend Action Helper 与插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个侧边栏,它出现在每一页上.侧边栏的第一个元素是 a) 登录表单,或 b) 当前用户的详细信息(取决于用户是否登录).

I have a sidebar which appears on every page. The first elements of the sidebar are either a) a login form, or b) details of the current user, (depending on whether the user is logged in or not).

我已经阅读了一些方法来实现这一点,并计划在引导程序中初始化一个侧边栏占位符.

I have read up on a few ways to accomplish this and am planning to initialise a sidebar placeholder in the bootstrap.

在将用户详细信息或登录表单附加到侧边栏时,我应该从 Action Helper 中的 predispatch 执行此操作吗?或者来自控制器插件中的预调度?为什么?

When it comes to appending the user details, or the login form, to the sidebar, should I be doing this from predispatch in an Action Helper? Or from predispatch in a controller plugin? Why?

谢谢!

推荐答案

我推荐阅读 使用操作助手实现可重复使用的小部件 作者:Matthew Weier O'Phinney(采埃孚负责人).

I recommend reading Using Action Helpers To Implement Re-Usable Widgets by Matthew Weier O'Phinney (ZF Lead).

在他的示例中,他在 Action Helper 中使用 public function preDispatch() 来创建可重用的登录/用户小部件.

In his example he uses public function preDispatch() in an Action Helper to create a reusable Login/User-Widget.

这篇关于Zend Action Helper 与插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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