I have a very odd issue. I've set up an application with different modules. As read in the docs, my main Bootstrap extends Zend_Application_Bootstrap_Bootstrap while the other module bootstraps extend Zend_Application_Module_Bootstrap.
My application.ini (related to modules) looks like this:
resources.frontController.controllerDirectory = APPLICATION_PATH "/modules/default/controllers"
resources.frontController.moduledirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultmodule = "default"
resources.frontController.throwerrors = true
resources.frontController.params.prefixDefaultModule = true
resources.view[] =
resources.modules =
Models, View Helpers, etc... are loaded correctly in the non-default modules. In the default module, I added an _initAutoload function like below:
protected function _initAutoload()
{
$autoloader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Default',
'basePath' => dirname(__FILE__),
));
return $autoloader;
}
This causes my models to be loaded correctly (i.e. Default_Model_User), but my default view helpers aren't. An example:
class Default_View_Helper_Test extends Zend_View_Helper_Abstract
{
public function test()
{
return "<p>DEFAULT::TEST</p>";
}
}
When I try to use it in my view template or layout template I get:
Plugin by name 'Test' was not found in the registry; used paths:
Zend_Dojo_View_Helper_: Zend/Dojo/View/Helper/:Zend/Dojo/View/Helper/
Zend_View_Helper_: Zend/View/Helper/:/var/www/amazium/application/modules/default/views/helpers/
Stack trace:
#0 /mnt/hgfs/projects/Library/Zend/View/Abstract.php(1117): Zend_Loader_PluginLoader->load('Test')
#1 /mnt/hgfs/projects/Library/Zend/View/Abstract.php(568): Zend_View_Abstract->_getPlugin('helper', 'test')
#2 /mnt/hgfs/projects/Library/Zend/View/Abstract.php(335): Zend_View_Abstract->getHelper('test')
#3 [internal function]: Zend_View_Abstract->__call('test', Array)
#4 /mnt/hgfs/projects/Cms/application/modules/default/views/scripts/index/index.phtml(9): Zend_View->test()
#5 /mnt/hgfs/projects/Library/Zend/View.php(107): include('/mnt/hgfs/proje...')
#6 /mnt/hgfs/projects/Library/Zend/View/Abstract.php(832): Zend_View->_run('/mnt/hgfs/proje...')
#7 /mnt/hgfs/projects/Library/Zend/Controller/Action/Helper/ViewRenderer.php(902): Zend_View_Abstract->render('index/index.pht...')
#8 /mnt/hgfs/projects/Library/Zend/Controller/Action/Helper/ViewRenderer.php(923): Zend_Controller_Action_Helper_ViewRenderer->renderScript('index/index.pht...', NULL)
#9 /mnt/hgfs/projects/Library/Zend/Controller/Action/Helper/ViewRenderer.php(962): Zend_Controller_Action_Helper_ViewRenderer->render()
#10 /mnt/hgfs/projects/Library/Zend/Controller/Action/HelperBroker.php(276): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#11 /mnt/hgfs/projects/Library/Zend/Controller/Action.php(522): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#12 /mnt/hgfs/projects/Library/Zend/Controller/Dispatcher/Standard.php(288): Zend_Controller_Action->dispatch('indexAction')
#13 /mnt/hgfs/projects/Library/Zend/Controller/Front.php(945): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#14 /mnt/hgfs/projects/Library/Zend/Application/Bootstrap/Bootstrap.php(77): Zend_Controller_Front->dispatch()
#15 /mnt/hgfs/projects/Library/Zend/Application.php(328): Zend_Application_Bootstrap_Bootstrap->run()
#16 /mnt/hgfs/projects/Cms/public/index.php(26): Zend_Application->run()
#17 {main}
I noticed in the error above that my view helper path was added correctly, but for some reason the prefix it has there is Zend_View_Helper_.
So, am I doing something wrong to get my default view helpers to work? Or is this a bug?
Thanks in advance,
Jeroen Keppens
没有评论:
发表评论