douzuita7325 2014-09-03 09:53
浏览 55
已采纳

Zend Framework 1.2 - 按模块配置

I have some plugins in zend framework and at the same time I have an application with various modules, I would like to know how to load plugins without all run on each request.

In module admin I have a function in bootstrap file:

public function _initPlugins() {
        Zend_Controller_Front::getInstance()->registerPlugin(new Admin_Plugin_SecurityCheck());
    }

In module affiliates I have a function in bootstrap file:

public function _initPlugins() {
        Zend_Controller_Front::getInstance()->registerPlugin(new Affiliates_Plugin_SecurityCheck());
    }

I just want to load plugins and settings per module and not in all modules. How can you do this? Thank you.

  • 写回答

1条回答 默认 最新

  • dongrong9938 2014-09-03 10:22
    关注

    You can replace standard Zend_Application_Resource_Modules resource, which load modules.

    For this:

    1. Create Your_Application_Resource_ModulesCustom, which extends from Zend_Application_Resource_Modules and disable automatic call of _initPlugins for modules.
    2. When you determine, which module must be loaded, you should manually call _initPlugins for this module.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部