I am interested in how other people handle website navigation. Not the styling or usability part, but the generation part. Most websites have some kind of “navigation tree” that is displayed in form of one or more menu levels – in what form do you save and process this tree? The simplest solution is a static menu template, something like this:
<ul id="menu">
<li><a href="…">One</a></li>
<li><a href="…">Two</a></li>
<li><a href="…">Three</a></li>
</ul>
But this is not very flexible. You can’t simply mark the current page in the menu and there’s no simple way of showing or hiding a part of the menu tree depending on the current page. (Or is it?)
I came up with a navigation tree, something like this:
- title: Fruits nodes: - title: Apples - title: Oranges - title: Bananas - title: Music and Stuff url: music nodes: - title: Classical - title: Jazz
This tree gets loaded by a special Navigation
class that can serve parts of the navigation depending on the current request path. This seems to work a bit better, but still I am very curious about other people’s solutions.