I am new to ZF, so my question might look newbish and I apologize in advance if its already answered.
The sequence in which ZF execute a complete process is
1. routeStartup
2. process route
3. routeShutdown
4. dispatchLoopStartup
5. preDispatch
6. dispatch process starts
7. controller's init method
8. controller's helper's preDispatch
9. action's preDispatch
10. action
11. action's postDispatch
12. controller's helper's postDispatch
13. postDispatch
14. dispatchLoopShutdown
now there are multiple places where we can initiate + config layout & theme details. We can do it on stage 5, 7, 8 and 9. What stage is the best for this purpose.
The application will be using AJAX so if I load the layout details on stage 5, there are lots of chances that later I will be removing the layout and sending only XML response.