i have used $view->addHelperPath and registerHelper what i want is when i go to view scripts files and do this $this->[myhlper method] get the data from my helper class ! i tried to set the path in the application.ini but that dosn't work either,so how to do it ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
in your Bootstrap, add this method :
protected function _initView()
{
$view = $this->bootstrap('layout')->getResource('layout')->getView();
$view->addHelperPath('Your/Custom/Path/', 'Your_Custom_Path');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
回答2:
You can add this addHelperPath
call in bootstrap, like me