Search code examples
phptemplateszend-frameworkzend-navigation

How to assign Zend_Navigator to the view?


I tried using Zend_Registry but it doesn't output anything then I tried this in my default module bootstrap

public function _initNavigation()
{
    $this->bootstrap('layout');
    $layout = $this->getResource('layout');
    $view = $layout->getView();        

But it says 'Resource matching "layout" not found'. Since I have two modules and I'm already using Zend_Navigation in the admin module, I don't know how to get over with this


Solution

  • You first have to create your layout resource.

    Here is how i did it:

      $navigation = new Zend_Config_Xml(APPLICATION_PATH.'/configs/navigation.xml','nav');
                    $navContainer = new Zend_Navigation($navigation);
                    $this->_view->navigation($navContainer);