Bootstrapping the Application: the Standard Navigation Resource Plugin
Saturday, September 26, 2009
Zend_Navigation is a Zend Framework component used to represent the pages on a web site and transform this into things such as page navigation and Google sitemaps. The standard navigation resource plugin Zend_Application_Resource_Navigation can be used to configure an instance of Zend_Navigation.
In the sample application, each of the site pages is added via a block of settings in the configuration file, which take the following form:
resources.navigation.pages.home.type = "Zend_Navigation_Page_Mvc" resources.navigation.pages.home.label = "Home" resources.navigation.pages.home.id = "home_page" resources.navigation.pages.home.controller = "index" resources.navigation.pages.home.action = "index"
The sub-element after pages (here home) is set to a unique name for the page. The purpose of all the settings for this element are as follows:
- type: This inidicates how the page location is represented. It is either Zend_Navigation_Page_Mvc, when the module/controller/action associated with the page is specified, or Zend_Navigation_Page_Uri, when a straightforward URI for the page is given.
- label: This is the string used when rendering the page name.
- id: This is the unique ID used to identify the page.
- controller: This is the controller associated with the page (see type above).
- action: This is the action associated with the page (see type above).
All the pages are of the type Zend_Navigation_Page_Mvc; the other settings are as follows:
- home: Home, home_page, index, index
- about: About Us, about_page, index, about
- contact: Contact Us, contact_page, index, contact
- blogs: Our Blogs, blogs_page, index, blogs
Zend_Application_Resource_Navigation will create a container object. It will then populate it with page objects based on the settings in the configuration file.
We will look at how the Zend_Navigation object is used in rendering the page navigation and sitemap in later posts.

Practical Web 2.0 Applications with PHP (Expert's Voice) by Quentin Zervaas
Beginning Databases with PostreSQL: From Expert to Professional 2nd Edition: From Novice to Professional by Neil Matthew, Richard Stones