views:

325

answers:

2

Just need to set up navigation per admin module, I know it is strange and not really good practice may be but I need to set it for admin part. thanks

+2  A: 

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();
fireeyedboy
thanks, btw does the Zend_Controller_Action_HelperBroker implement some well known design patters, just the word broker sound very like a pattern ?
simple
I guess it implements the Broker Pattern. ;-) Not farmiliar with it to be honoust. So I couldn't tell you much more about it.
fireeyedboy
Ok thanks, then will stumble the Broker pattern myself.
simple
A: 

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

simple