开发者

How access action helper in view script?

开发者 https://www.devze.com 2023-02-28 21:11 出处:网络
How access action helper in view script? $this->view->helper = $this->_h开发者_C百科elper->SomeHelper;

How access action helper in view script?

$this->view->helper = $this->_h开发者_C百科elper->SomeHelper;

Any other ideas?


You can't ... or at least you can't do that "normally". You can do

$this->view->whatever = $this->_helper->flashMessager;

But it's not the right way... I guess. You can do it also using static call, which is little better.

$flashMessenger = Zend_Controller_Action_HelperBroker::getStaticHelper('flashMessenger');


In your Bootstrap.php make sure to register the view helper directory

$view->addHelperPath(APPLICATION_PATH .'/views/helpers', 'View_Helper');
$view->addHelperPath('ZendX/JQuery/View/Helper/','ZendX_JQuery_View_Helper'); 

then in your view just call

echo $this->someHelper();
0

精彩评论

暂无评论...
验证码 换一张
取 消