The menu structure is defined by a multidimensional hash. This makes it quite easy to generate and traverse:
Пример 42-1. Menu multidimensional hash
|
The menu entries can also contain custom keys. If such keys are present, then they will be used by renderers in creating the output (this usually means that the content of such a key will be assigned to the template placeholder with the same name).
HTML_Menu supports five output modes: 'tree' (default), 'rows', 'urhere', 'prevnext' and 'sitemap'. Lets use the array defined above as menu structure assuming that element 'Menu item 1.2' is currently active and try each menu type.
Possible menu types
This type of the menu mostly follows the internal structure of the menu hash. Different levels of the menu are marked by indentation, only the elements leading to the active item or immediately following it are shown.
This is quite similar to 'tree' type, only different levels are not marked by indentation, but are shown on different rows of the menu.
This is so-called 'breadcrumb' navigation, allowing to easily understand your position within site hierarchy.
Пример 42-4. Output for menu type 'urhere'
|
This is the menu often used in documentation (including the PEAR manual), the links lead to previous, next and parent entries of the current entry.
This is 'tree' type menu, but with all entries shown.
Пример 42-7. Very basic usage example
|
Пред. | Начало | След. |
HTML_Menu | Уровень выше | constructor HTML_Menu::HTML_Menu() |
HIVE: All information for read only. Please respect copyright! |