Christian Heilmann

Generating site navigation with PHP and DOM

Thursday, April 7th, 2005 at 11:35 am

I just finished EasyNav, a PHP script that automatically highlights the current page in a site navigation.

All you need to use it is generate your navigation as a nested list of links and include EasyNav in your pages. The current link gets automatically replaced with a “strong” element and gets the ID “current”. The parent list item gets the ID “active”.

This allows you to use the CSS examples of Listamatic to style your navigation.

EasyNav also allows for different navigations to be generated, dependent on the ID of the root UL.

Share on Mastodon (needs instance)

Share on Twitter

My other work: