views:

39

answers:

2

I was reading the answer to the question here and the wording was a bit confusing. I shortened the sentences to focus on my question

  • First preDispatch() is called for instances of Zend_Controller_Plugin_Abstract...
  • init() of the Zend_Controller_Action is called next...
  • The controller's preDispatch() method is called here...

Does that mean that in the controller itself, init code runs first before the preDispatch code?

There's a preDispatch that runs first but it's not for controller code, just for code that may exist in any outside plugins, correct?

+3  A: 

init runs before preDispatch, init is short for initialisation (or initialization is your American).

So it runs first to initialisation anything you might need later in the Controller

jakenoble
+1  A: 

Indeed, the init runs before preDispatch. A complete flow of events is visualized in this diagram:

For me it was very useful to understand the complete Zend Framework frontcontroller structure.

Jurian Sluiman