tommyd
tommyd

Reputation: 39

How access action helper in view script?

How access action helper in view script?

$this->view->helper = $this->_helper->SomeHelper;

Any other ideas?

Upvotes: 1

Views: 1234

Answers (2)

Tomáš Fejfar
Tomáš Fejfar

Reputation: 11217

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');

Upvotes: 4

emeraldjava
emeraldjava

Reputation: 11212

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();

Upvotes: -2

Related Questions