Understanding the stack index for Zend Framework Controller plugins

Simon R Jones writes a very help­ful arti­cle about the stack index (the order you fire plu­g­ins) and how to cus­tomize it;

Zend Frame­work Con­troller plu­g­ins are a pow­er­ful way to inject logic into your con­troller sys­tem at var­i­ous points, such as before and after an action dis­patch. Plu­g­ins are run in the order they are added, though it is pos­si­ble to change the order by defin­ing a cus­tom stack index. ZF inter­nal plu­g­ins such as Zend_Controller_Plugin_ErrorHandler, which dis­plays a nice Error 404 page, has a stack index of 999 to ensure it runs at the end of any plu­gin cycle. How­ever, it’s not so obvi­ous from the ZF man­ual how to set a cus­tom stack index.

For exam­ple, you may have a com­mon admin sys­tem lay­out that does var­i­ous things to your admin page lay­out before the page is displayed…

more at simon r jones.

Tags: , ,

Leave a Comment

*

Get Adobe Flash playerPlugin by wpburn.com wordpress themes