|
|||
|
Unless I'm mistaken, if you manually instance your view class in your bootstrap, via the ViewRenderer helper (which gets registered in the Helper Broker), then that one will be used throughout your controllers.
Zend Framework: Documentation Before you register your Zend_View class with the Helper, just assign the path there. As a more generic solution to these kinds of problems, you may also want to consider using an intermediate Controller subclass for your application-wide settings, so that you can do app-specific stuff like this once only. So instead of having Your_Controller (for example) extend Zend_Controller_Action directly, you create App_Controller that extends Zend_Controller_Action (and optionally <Module>_Controller that extends App_Controller if your are using modules, and have <Module> be the name of your module) and then have Your_Controller extend either App_Controller or <Module>_Controller as is appropriate. This technique allows you to put stuff in the init() methods of App_Controller and <Module>_Controller that get applied to all the subclass controllers easily and once only, and makes maintenance easier and keeps your code more elegant. |
|
||||
|
I had already thought about extending Zend_Controller_Action, but this looks inelegant to me, at least for such little improvement (adding a helper path in the view)...
I will try the solution you propose, that of instancing the view in the bootstrap via the ViewRenderer helper... Thank you. |
|
||||
|
Generally we set view helper paths in the bootstrap....
First, you must get a ViewRenderer instance then set your view instance to it... WebSVN - spotsecng-backup - Rev 187 - /branches/potatobob/src/webconsole/htdocs/index.php
__________________
Zym Framework - A Zend Framework extension library w/ demo app SpotSec Blog: http://spotsec.com/blog |
![]() |
| Thread Tools | |
| Display Modes | |
|
|