Understanding the stack index for Zend Framework Controller plugins

Simon R Jones writes a very helpful article about the stack index (the order you fire plugins) and how to customize it;

Zend Framework Controller plugins are a powerful way to inject logic into your controller system at various points, such as before and after an action dispatch. Plugins are run in the order they are added, though it is possible to change the order by defining a custom stack index. ZF internal plugins such as Zend_Controller_Plugin_ErrorHandler, which displays a nice Error 404 page, has a stack index of 999 to ensure it runs at the end of any plugin cycle. However, it’s not so obvious from the ZF manual how to set a custom stack index.

For example, you may have a common admin system layout that does various things to your admin page layout before the page is displayed…

more at simon r jones.

Leave a Reply

Your email address will not be published. Required fields are marked *