Or am I completely missing the point of Zend_Application and is there already a better way of doing this?

You already identified the way to do this: controller plugins.


Matthew is right, controller plugins are the ideal way to hook into the dispatch cycle with runtime logic.

Another consideration might be if you have stateful information that your modules Action Controllers might need. If this is the case, (more advanced usage), you might want to create an abstract action controller for your module that all action controllers will inherit. Whatever methods you decide to override, be sure to call the related parent method. For example, if you inject your logic into __constrcut(), be sure to also call parent::__construct().

This method will allow you to keep Action Controller specific stateful logic inside your action controller which will be executed every time an action controller is loaded and dispatched.

-ralph

Reply via email to