I actually tried actionstack. <?php class Customers_IndexController extends Zend_Controller_Action {
function init() { $this->initView(); Zend_Loader::loadClass('Customers'); $this->view->baseUrl = $this->_request->getBaseUrl(); $this->view->user = Zend_Auth::getInstance()->getIdentity(); } function preDispatch() { $auth = Zend_Auth::getInstance(); if (!$auth->hasIdentity()) { $this->_redirect('auth/login'); } } function indexAction() { $this->_helper->actionStack('menu','navigation','default'); $this->view->title = "Customers"; $customers = new Customers(); $this->view->customers = $customers->fetchAll(); } And this seems to work. I am not sure if its the best way to go about it but it works. I am curious about the plugin model u suggested Tobias. ++Tx Peter vladimirn wrote: > > Not so hard i think. > If i understud well, you should use $this->_forward at the end of you > action. > So lets say you have IndexController.php and in this controller you want > to use forward > <?php > > class IndexController extends Zend_Controller_Action > { > public function indexAction() > { > //there is some stuff you want to do > //and now you are calling your NavController > $this->_forward('menu','nav'); // where 'menu' stand for menuAction in > NavController and 'nav' is a NavController.php > } > } > > Also you will like to setup in scripts/view/nav/menu.phtml and put in this > file whatever you want > > then in you layout.phtml just call <?=$this->layout()->nav ?> > > i hope this will work or help :) > > > > > pvechi wrote: >> >> Thanks for your reply Tobias. >> >> In my example where I send only the title to the nav variable, i do so >> for illustrative purposes. Eventually i want to send a complete >> navigation menu. >> >> However, I am looking for direction with the code based on the example in >> the ZF documentation. I am unsure how to create the menu based on the >> layout view script, actionstack, or maybe the use of _forward, as it >> implies in the doucmentation. >> >> ++Tx >> >> Pete >> >> >> Tobias Schifftner wrote: >>> >>> Normally you should not always forward to an other action. Only if you >>> really need to do so. Not all the time... >>> >>> Well, as I can see you use already <?= $this->layout()->content; ?>, so >>> all other $this->view variables will be within that. In your view script >>> view/scripts/action.phtml you can just use >>> >>> <?= $this->title ?> >>> >>> But this only works when you not forward all the time. Just stay in you >>> indexAction() function and you can easily use your variables in >>> view/scripts/index.phtml >>> >> >> > > -- View this message in context: http://www.nabble.com/Zend-Layout-and-_forward-tp19178382p19219839.html Sent from the Zend Framework mailing list archive at Nabble.com.