To create navigation menu items in the Zend Framework by storing all the information in your config application.ini file turns out to be a relatively simple affair.
First add the following line to your application.ini file:
resources.navigation.storage.registry[] =
Next define your pages as follows:
resources.navigation.pages.home.label = "Home" resources.navigation.pages.home.controller = "index" resources.navigation.pages.home.action = "index" resources.navigation.pages.item2.label = "Next Item" resources.navigation.pages.item2.controller = "nextitem" resources.navigation.pages.item2.action = "index" ;for modules try: resources.navigation.pages.home.label = "Home" resources.navigation.pages.home.module = "admin" resources.navigation.pages.home.controller = "index" resources.navigation.pages.home.action = "index" ;for sub menu items: resources.navigation.pages.home.pages.sub.label = "Sub1" resources.navigation.pages.home.pages.sub.controller = "sub" resources.navigation.pages.home.pages.sub.action = "index"
Now that your pages have been defined, your bootstrap file can be used to initiate the layout, which in turn initiates the navigation object automatically. If you check your bootstrap file, you should have a function looking something like this:
protected function _initNavigationConfig()
{
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$view = $layout->getView();
}
Finally, to actually print out the navigation menu in your layout, simply add the following line somewhere in your layout.phtml file:
$this->navigation()->menu();
As easy as that.
Note that if you want breadcrumbs in your layout, you can use this:
echo $this->navigation()->breadcrumbs()
->setLinkLast(false)->setMinDepth(0)->render();
Nifty.