I’m not sure how everyone else is using Zend_Layout, but I’m doing the following to render my navigation and footer links. It’s not the most DRY code, but works until I learn more about the framework.

In my Action file, I add actions to the stack for nav, footer, etc.

class IndexController extends ....
{
function indexAction()
{
$this->_helper->actionStack('main', 'nav', 'default');
$this->_helper->actionStack('footer', 'nav', 'default');
$this->_helper->actionStack('right', 'nav', 'default');
/* other stuff */
}
}

Then I have a NavController that simply calls setResponseSegment or renderScript to set the named variables.


class NavController ..
{
function footerAction()
{
/* Stuff to display */
$this->renderScript('nav/footer.phtml', 'nav');
// Or I could use
// $this->_helper->viewRenderer->setResponseSegment('nav');
}
}

This allows me to finally use the nav variable in my layout file
layout/default.phtml

echo $this->layout()->nav;

Simple eh?