0

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.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

1
  • You are breaking the naming scheme of Zend Framework by renaming the Zend folder to ZF. This may cause problems in other places within the application as well. Commented Jun 20, 2011 at 1:05

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

3 Comments

Indeed. Sounds like the Zend_View instance is being replaced at some point.
thnks that was exactly as you said i mistakely created new instance in controller action that i replaced now with:Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view'); But now a new problem when i remove the _initViewHelper function as you said all custom view Helpers in the main Layout is not recognized again
@user796767 More convenient way to get view instance is $view = Zend_Conroller_Action_HelperBroker::getStaticHelper('viewRenderer')->getView();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.