The Zend_Controller_Front
plugin hooks are the following (from here):
routeStartup()
is called before Zend_Controller_Front
calls on the router to evaluate the request against the registered routes.
routeShutdown()
is called after the router finishes routing the request.
dispatchLoopStartup()
is called before Zend_Controller_Front
enters its dispatch loop.
preDispatch()
is called before an action is dispatched by the dispatcher. This callback allows for proxy or filter behavior. By altering the request and resetting its dispatched flag (via Zend_Controller_Request_Abstract::setDispatched(false)
), the current action may be skipped and/or replaced.
postDispatch()
is called after an action is dispatched by the dispatcher. This callback allows for proxy or filter behavior. By altering the request and resetting its dispatched flag (via Zend_Controller_Request_Abstract::setDispatched(false)
), a new action may be specified for dispatching.
dispatchLoopShutdown()
is called after Zend_Controller_Front exits its dispatch loop.
So dispatchLoopShutdown()
is your hook to go - it's the last thing Zend_Controller_Front::dispatch()
does before returning or sending the response.
Another option could be, even though they were designed for something completely different, to use Zend_View
filters. These filters can be added to the Zend_View
-instance and are called in Zend_View::render()
. A filter is simply an instance of a class that provides a filter($buffer)
-method that returns the filtered $buffer
. But using this interface for something not related to filtering the ouptut, seems not to be the correct way actually.
I personally think, that a dispatchLoopShutdown()
-plugin will be the way to go.