zend-framework,从另一个动作助手中调用动作助手 [英] zend-framework, call an action helper from within another action helper

查看:27
本文介绍了zend-framework,从另一个动作助手中调用动作助手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个动作助手,我需要从该助手中调用另一个动作助手.但我不知道如何.在示例代码中:

i am writing an action helper and i need to call another action helper from within that helper. but i dont know how. here in the sample code:

class Common_Controller_Action_Helper_SAMPLE extends Zend_Controller_Action_Helper_Abstract
{
    protected $_view;
    public function __construct(Zend_View_Interface $view = null, array $options = array())
    {
        $this->_view = $view;
    }

    public function preDispatch()
    {
        $flashMessenger = $this->_helper->FlashMessenger; // IT IS NULL
    }
}

推荐答案

使用 动作助手代理:

$flashMessenger =
    Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger');

这篇关于zend-framework,从另一个动作助手中调用动作助手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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