开发者

Zend Framework - Access view inside plugin

How to access view inside plugin.

For example i have language plugin and i need to add to add javascript lang开发者_JS百科uage array depending on language plugin output.

Thanks ;)


BTW this works on my project:

    Zend_Controller_Action_HelperBroker::getStaticHelper('Layout')
       ->getView()

But this doesn't work:

    Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')
       ->getView()

Maybe because the layout is enabled.


Many ways, depends what you want to do.

You can grab view from viewRenderer which you can get from HelperBroker.

$vr = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$view = $vr->getView();

You may also try to get it as application resource from boostrap:

$view = $this->getActionController()->getInvokeArg('view');

or

$front = $this->getFrontController();
$view = $front->getParam('boostrap')->getResource('view');

(not tested)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜