开发者

How to get View From child of Zend_Controller_Plugin_Abstract?

Just need to set up navigation per admin module, I know it is strange and not really good practic开发者_如何转开发e may be but I need to set it for admin part. thanks


Try this:

$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
if (null === $viewRenderer->view) {
    $viewRenderer->initView();
}
$view = $viewRenderer->view;

This excerpt is taken from Zend_Layout::getView();

If you are going to need the layout anyway too, you could extend Zend_Layout_Controller_Plugin_Layout in stead of Zend_Controller_Plugin_Abstract.

Then, to access the layout do:

$this->getLayout();

And to access the view, do:

$this->getLayout()->getView();


Ok, I retrieved like

$layout = Zend_Layout::getMvcInstance();
$navigation = $layout->getView()->navigation();

inside the plugin that extends Zend_Controller_Plugin_Abstract thanks thoug, still better methods are welcome

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜