views:

64

answers:

2

hello

i registered 2 plugin in my project on zend framework the first one in application.ini this is for change layout resources.frontController.plugins.LayoutSet="App_Plugins_LayoutSet" and second in the registred in the bootstrap

 $fc= Zend_Controller_Front::getInstance();
          $fc->registerPlugin(new App_Plugins_AccessCheck($this->_acl));

2 plugin work fine , i want to know what plugin execute at first , can we change prior's execute for these plugin?

+3  A: 

Plugins are triggered in the same order they are registered. You can override this behavior by passing a "stack index" when registering Plugins.

The OO way:

$front->registerPlugin(new FooPlugin(), 1);   // will trigger early
$front->registerPlugin(new BarPlugin(), 100); // will trigger late

The application.ini way:

resources.frontController.plugins.foo.class = "FooPlugin"
resources.frontController.plugins.foo.stackIndex = 1      // will trigger early
resources.frontController.plugins.bar.class = "BarPlugin"
resources.frontController.plugins.bar.stackIndex = 100    // will trigger late

Source: Zend Controller Plugins in ZF

yenta
A: 

The above answer is only partially correct. Yes, the plugins are triggered in the same order they are registered in but it also matters which event method a plugin uses. For instance, preDispatch() will be triggered before postDispatch() and so on.

See http://framework.zend.com/manual/en/zend.controller.plugins.html

Richard Knop