Highlighting the current menu item
It's important to be able to do this so the user doesn't get lost. It can be done either server side or client side - I think it is more useful to do it client side.
Client side highlighting allows client side HTML includes
- Code maintenance is simpler - although this is a benefit shared by server side includes.
- Server load is reduced when serving purely static content.
- The navigation HTML can be cached - independently of the pages in which it is included.
Using frames has the same advantage, but it also has plenty of disadvantages, not least of which is that making a menu in one frame pop-up over text in another is difficult.
How to do client-side includes
There are four ways that I know of, all of which have significant disadvantages:
- Use an IFRAME or ILAYER
- Use XHTML and an external entity defined in the page's DTD - for example:
and then include the navigation with
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [ <!ENTITY navigation SYSTEM 'nav.txt'> ]>>
The menus themselves will still not work properly in IE - and won't until it supports the CSS :hover attribute correctly.