Quote:
Originally Posted by Elemental
Davidoff's solution is indeed simple, however it appears as though you're using a conventional modular file structure. If so, then once you have helpers in modules other than default Davidoff's solution will stop working for you.
You could set the helper path per request via an Action Helper and set it based on the requested module as so:
PHP Code:
<?php
require_once('Zend/Controller/Plugin/Abstract.php');
class MyApp_Controller_Plugin_ModularHelperPath extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$moduleName = $request->getModuleName();
$rootDir = Zend_Registry::get('rootDir');
set_include_path(get_include_path() .
PATH_SEPARATOR . $rootDir . '/application/' . $moduleName . '/views/helpers/');
}
}
$rootDir = Zend_Registry::get('rootDir') assumes you have set the rootDir in your bootstrap, otherwise you will need to adjust the script to set the paths appropriately.
|
Thanks for the reply guys.
I will try the Davidoffs solution, I was hoping was something that would work by putting it in the bootstrap file once, seems like this should work.