26-11-2009

Zend Framework Register plugins in ZF application.ini

To register frontController plugins in the ZF (1.8 and higher) application.ini file you can use the following syntax:

autoloaderNamespaces[] = "HardCode_"
 
resources.frontController.plugins.Whatever = "HardCode_Controller_Plugin_Whatever"

This asumes you have your plugin in the directory :

/path/to/library/HardCode/Controller/Plugin/Whatever.php

And your plugin goes a little something like this:

<?php
 
class HardCode_Controller_Plugin_Whatever extends Zend_Controller_Plugin_Abstract {
 
    public function preDispatch(Zend_Controller_Request_Abstract $request) {
        //code for your plugin here...
    }
}

Source:

http://blog.ekini.net/2009/06/04/registering-your-custom-plugins-in-zend-framework-18/

Comments:

Your comment:

»

 

[x]