view script doesn't recognizing view helpers in zend framework
my problem is fairly when I call a view helper from view script it can't be called although I added properly all information path to the config file via this line:
resources开发者_JS百科.view.helperPath.ZF_View_Helper_="ZF/View/Helper/"
also I registered the helper in bootstrap file
function _initViewHelpers(){
$view = new Zend_View();
$view->addHelperPath('ZF/View/Helper','ZF_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
but in vain it still printing out this error message:
Application error
Exception information:
Message: Plugin by name 'OutputHelper' was not found in the registry; used paths:
Zend_View_Helper_: Zend/View/Helper/
it doesn't include the custom view helper path as expected ;
the path of the view helper is: library/ZF/View/Helper/OutputHelper.php
can you do this:
in view script
$view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
var_dump($this === $view);
var_dump($view->getHelperPaths());
exit;
I think your view instance are replaced at some point. May be module's bootstrap have view resource?
Or it can be other obvious mistake. So obvious so you'll never think of it
btw remove that _initViewHelpers method. Zend_Application_Resource_View work just fine for that. And if you use this method, use it correctly, eg:
$this->bootstrap('view');
$view = $this->getResource('view');
//whatever
精彩评论