【问题标题】:Use default module's action helpers in another module with Zend Framework在 Zend Framework 的另一个模块中使用默认模块的操作助手
【发布时间】:2012-05-08 13:50:14
【问题描述】:

我想我已经尝试了所有发现的方法来解决这个问题,包括 SO 上的所有答案。

在我的项目中有一个admin 模块,然后是默认模块。现在我希望管理模块使用默认模块的助手。最好仅当没有同名的管理模块助手时。这可能吗?

我得到的错误信息是:

消息:在注册表中找不到名为“HeadBase”的插件;用过的 路径:Admin_View_Helper_: /application/modules/admin/views\helpers/ Zend_View_Helper_: Zend/View/Helper/

我使用 ZF 1.11

【问题讨论】:

    标签: zend-framework view-helpers


    【解决方案1】:

    找到了解决办法。在Bootstrap 中,为助手添加一个init,如下所示:

    protected function _initHelpers()
    {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->addHelperPath(APPLICATION_PATH . '/views/helpers/', 'Zend_View_Helper');
    }
    

    这会为类前缀为 Zend_View_Helper 的助手添加助手路径 APPLICATION_PATH . '/views/helpers/'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多