Main Page
From phpmenu
Contents |
Introduction
- How many times have you been wondering "why-o-why they couldn't decide where this pages belong to?"
- How many pages have you updated adding just one Item on the Menu?
- Have you ever thought of that it would have been wonderful to have all Menu Items listed in one single file?
You can bear changing many pages each time or create a single file that will hold the Navigation for the whole website. Moving MenuItem from one section to another will take no more then a minute.
I'd like to introduce you to phpMenu Library - PHP Library for building Navigation blocks (Menus) for Web Site Developers. The Library allows to build Complex Navigation with folding sections, infinite number of nested subsections, visual presentation is CSS-driven. No JavaScript required.
Table of Contents
- Sample Menu
- Menu Types in Action
- MenuItem Types in Action
- Many Levels Deep
- Look and Feel
- Menu Gallery
Available Classes
Menu Types
- Menu
- your menu that will always show
- CollapsingMenu
- your menu with the ability to collapse/fold when not active
- HidingMenu
- your menu with the ability to hide when not active
- SubMenu
- your sub-menu
MenuItem Types
- MenuItem
- your regular Menu Item
- ExternalItem
- Menu Item is External to the site
- HiddenItem
- Menu Item that is not Visible in the Menu (is hidden)
- GETQueryHiddenItem
- Menu Item that is not Visible in the Menu (is hidden) and activates based on GET parameters passed to the page
- InactiveItem
- Menu Item that never gets the active state
- PassiveItem
- Menu Item that is not a link (e.g. for Menu separators)
Attributes
- $title
- item Title
- $base_url
- site URL
- $path
- relative path to Item
- $query_id
- field name (query string related)
- $query_value
- value (query string related)
- $css_class
- item's class name (CSS related)
- $elements
- elements of the Section (only in menu & submenu)
Instantiation
Menu ($title, $base_url)
SubMenu ($title, $path)
MenuItem ($title, $path, $css_class=NULL)
GETQueryHiddenItem ($title, $path, $query_id=NULL, $query_value=NULL, $css_class=NULL)
Important methods
setBaseURL($menu->getBaseURL())
draw($current_url)
Helper functions
newSubMenu ($title,$path,$base_url,$elements=array())
Why phpMenu
- You can have as many levels of navigation as you wish.
- The navigation is not dependant on the directory structure.
- It’s completely CSS-driven.
- It’s reusable.
- It’s easy-to-read.
- It’s customizable and extendable:
- You can make it draw 2 levels on the left and the rest on the right side of the page.
- You can choose to re-use some other navigation and chose only the items you need.
- You can use more then one navigation file per page.

