zend action helpres 使用控制器所需的解释

发布于 2024-10-07 04:17:45 字数 560 浏览 0 评论 0原文

有人可以告诉我 zend action helpers 到底是如何工作的吗?我的意思是,尽管我已经在我的代码中使用了它们,但我觉得我的理解中缺少一些东西:

例如,我的代码中有这样的东西

$this->_helper->viewRenderer->setRender('edit',null,true);

,所以我会能够渲染添加操作以使用编辑页面(因为添加与编辑相同......至少在 UI 基础上),

但我的问题是,据我所知 _helper 是一个实例,

/**
 * Helper Broker to assist in routing help requests to the proper object
 *
 * @var Zend_Controller_Action_HelperBroker
 */
protected $_helper = null;

但是当我尝试在库文件夹中查看此类“Zend_Controller_Action_HelperBroker”,我找不到名为“viewRenderer”的属性

can some one tell me how zend action helpers exactly work , i mean , even though i already used them in my code i feel some thing is missing in my understanding :

e.g. i have some thing like this

$this->_helper->viewRenderer->setRender('edit',null,true);

i my code , so that i will be able to render add-actions to use edit pages (since adding is the same as editing ..... on UI basis @ least )

but my question here is , as far as i can see the _helper is an instance of

/**
 * Helper Broker to assist in routing help requests to the proper object
 *
 * @var Zend_Controller_Action_HelperBroker
 */
protected $_helper = null;

but when i try to see in the library folder this class "Zend_Controller_Action_HelperBroker" i can't find a property named "viewRenderer"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一片旧的回忆 2024-10-14 04:17:45

$_helper 是一个神奇的小东西,可以在需要时加载操作助手。它会在注册路径中查找 - 默认情况下是 Zend/Controller/Action/Helper - 您可以在其中找到 viewRenderer 帮助器。

该类没有 viewRenderer 属性的事实是因为 HelperBroker 通过神奇的 __call 方法处理所有请求。

此调用方法查找助手(在本例中为 viewRenderer)并调用该助手上的 direct() 方法。

The $_helper is a magical little thing that loads action helpers when needed. It looks in registered paths - which by default is Zend/Controller/Action/Helper - which is where you'll find the viewRenderer helper.

The fact that the class doesn't have a viewRenderer property is because the HelperBroker handles all requests via the magic __call method.

This call method looks for a helper (in this case viewRenderer) and calls the direct() method on that helper.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文