开发者

preDispatch() is not called in Controller Plugin

class My_Plugin extends Zend_Controller_Plugin_Abstract
{

    public function init()
    {
         print 'this is working just fine';
    }

    public function  preDispatch( Zend_Controller_Request_Abstract $request )
    {
        Zend_Debug::dump($request);
        print 'why is it not working';
        exit;
        die(':(');   // not dieing either     
    }
}

The plugin is registered in /configs/application.ini file. ZF does see it, because init() function works perfectly fine. But nothing I put into preDispatch seems to work.

P.S. the only purpose of this plugin is to determine what language is used from the parameter in URL, and set Zend_Locale to it. So that I won't need to do it in any controller or view ever again, instead relying on Zend_Locale, Zend_Translate, etc. But I can't do that in plugin's init() and preDispatch() doesnt work at al开发者_如何学Pythonl :/ The lack of proper documentation for ZF starting to drive me crazy


The problem was I needed to add one line to application.ini:

resources.frontController.plugins.myplugin = Plugins_My_Plugin 

Everything works now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜