EasyNav - Keeping navigation clean and current

EasyNav is a PHP script that allows you to automatically highlight the current section in a navigation.

All you need to do is:

EasyNav then does the following:

The IDs set by EasyNav are "active" for the current list item and "current" for the strong element. This allows you to use any CSS of Listamatic to style your navigation.

If your PHP installation has the domxl extension enabled, EasyNav offers even more.

Depending on which ID is set on the root UL of your navigation template:

EasyNav Demos

Customising the script

All the ID names to trigger the different navigation types and the classes and IDs added to the HTML can be changed in the variables section of the script:


/* Variables */
// id added to the current LI
    
$listitem_id='active';     
// id added to the current A
    
$link_id='current';     
// navigation file
    
$nav='nav.html';        
/* Variables dependent on DOMXML availability */
// class added to each LI containing the current one
// and the parent link
    
$parentclass='parent';    
// ID to remove non-active sub navigations
    
$rsnID='navrsn';        
// ID to remove non-active sub navigations and show the
// current sub navigation first
    
$rsncnoID='navrsncno';    
// ID to remove non-active sub navigations and show the
// current sub navigation
// after the home link
    
$rsncnonhomeID='navrsncnohome';
// ID to show the current sub navigation after the home link
    
$cnonhomeID='navcnohome';
// ID to show the current sub navigation first
    
$cnoID='navcno';

Download

The zip downloadable here contains the script itself, this information page and the demos.

Creative Commons License Unless otherwise expressly stated, all original material of whatever nature created by Christian Heilmann and included in this web site and any related pages is licensed under the Creative Commons License.

More at onlinetools.org