I've already posted this in another thread, but I think it's worth starting a new thread on this topic, since I think it's something that people using the modular structure will find sooner or later.
The thing is... my application is structured following the conventional modular structure:
Code:
/application
/config
/library -> my custom plugins, etc
/logs
/models
/modules
/default
/controllers
/views
/filters
/helpers
/scripts
/other-module
/etc...
/library
/Zend
/3rd party libraries...
/public_html
I think it is very convenient to be able to use certain custom view helpers throughout all the modules (just the same way we have plugins that are registered in the bootstrap file), but I might be missing something with the helper paths, since the only way I've found to do this is a bit awkward.
I understand that, at least in the current version of the framework (1.0.0), views are instantiated by the controllers, so there's no way to access the views from the bootstrap file, hence it's not possible to set view helper paths from there.
If I want to set a path to store all of my "global" view helpers, what I'm doing right now is overriding all of my controllers' "init" function to add a line like this:
Code:
$this->view->addHelperPath('./../application/library/mycustomviewhelpers');
Altough this works, doing this is a pain, and it's not very elegant. By the way, it's pretty ugly to have to deal with relative paths in the controllers... I know, I could set up the path in the bootstrap and store it in the registry to retrieve it in the controller, but that wouldn't keep me from rewriting the init() methods.
Does anyone know of a better way to achieve this without having to rewrite each an every init() method? Maybe the solution is very simple and I'm just being a little stupid...