This has been driving me nuts for days. There is so little documentation on this out there I guess because it’s a newer feature and Zend’s reference manual is lacking.
With Zend Framework 1.9.x, you can instantiate a lot of stuff automagically simply by adding specific commands to the config application.ini. For instance, in order to instantiate a Zend Layout, you simply have to add the line
resources.layout.layoutPath = APPLICATION_PATH "/views/layouts"
That is in lieu of a dozen or so lines in the bootstrap file. Then you can create your layout.phtml as you normally would in that layouts directory.
The reference manual for Zend Application says you can do something similar for Zend Navigation (which is how you can generate menus, breadcrumbs, and a sitemap), however try as I might, I couldn’t work it out. Finally I got it to work.
So let’s say you want to make a menu that looks like this:
- Home
- Login
- List Objects
- -> Add New Object (subpage of “List Objects”)
And you have two controllers, index and object. Index has a login action, and object has an add action.
Here’s how you lay it out in application.ini
resources.navigation.pages.home.label = "Home"
resources.navigation.pages.home.controller = "index"
resources.navigation.pages.home.action = "index"
resources.navigation.pages.login.label = "Login"
resources.navigation.pages.login.controller = "index"
resources.navigation.pages.login.action = "login"
resources.navigation.pages.object.label = "List Objects"
resources.navigation.pages.object.controller = "object"
resources.navigation.pages.object.action = "index"
resources.navigation.pages.object.pages.add.label = "Add New Object"
resources.navigation.pages.object.pages.add.controller = "object"
resources.navigation.pages.object.pages.add.action = "add"
I probably tried a dozen different things here before I got the format correct. That “resources.navigation.pages” thing was messing me up the most, and I ended up figuring it out by first implementing it using the old bootstrap and xml config file method, then translating to this method. Also the Zend manual was using the word “page” to represent a page name, which combined with the keyword “pages” to be confusing.
Anyhow, the above code can then be used like this in your view:
< ?= $this->navigation()->menu() ?>
or
< ?= $this->navigation()->breadcrumbs() ?>
It’s easy in retrospect, but was pissing me off for a while. More examples online would have helped.

