Introduction to Zend\Navigation

Zend\Navigation is a component for managing trees of pointers to web pages. Simply put: It can be used for creating menus, breadcrumbs, links, and sitemaps, or serve as a model for other navigation related purposes.

Pages and Containers

There are two main concepts in Zend\Navigation:

Pages

A page (Zend\Navigation\AbstractPage) in Zend\Navigation – in its most basic form – is an object that holds a pointer to a web page. In addition to the pointer itself, the page object contains a number of other properties that are typically relevant for navigation, such as label, title, etc.

Read more about pages in the pages section.

Containers

A navigation container (Zend\Navigation\AbstractContainer) is a container class for pages. It has methods for adding, retrieving, deleting and iterating pages. It implements the SPL interfaces RecursiveIterator and Countable, and can thus be iterated with SPL iterators such as RecursiveIteratorIterator.

Read more about containers in the containers section.

Note

Zend\Navigation\AbstractPage extends Zend\Navigation\AbstractContainer, which means that a page can have sub pages.

View Helpers

Separation of data (model) and rendering (view)

Classes in the Zend\Navigation namespace do not deal with rendering of navigational elements. Rendering is done with navigational view helpers. However, pages contain information that is used by view helpers when rendering, such as; label, class (CSS), title, lastmod and priority properties for sitemaps, etc.

Read more about rendering navigational elements in the view helpers section.

Table Of Contents

Previous topic

Examples

Next topic

Quick Start

This Page

Note: You need to stay logged into your GitHub account to contribute to the documentation.

Edit this document

Edit this document

The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.

  1. Login with your GitHub account.
  2. Go to Introduction to Zend\Navigation on GitHub.
  3. Edit file contents using GitHub's text editor in your web browser
  4. Fill in the Commit message text box at the end of the page telling why you did the changes. Press Propose file change button next to it when done.
  5. On Send a pull request page you don't need to fill in text anymore. Just press Send pull request button.
  6. Your changes are now queued for review under project's Pull requests tab on GitHub.