Return to Snippet

Revision: 13484
at April 25, 2009 14:52 by grazz

Initial Code
// At the top of the page that includes the navigation:
$page = basename($_SERVER['SCRIPT_NAME']);

// In the navigation page that gets included:<br />

// Add in the <a> tag after the href attribute:
class="<?php if ($page == example.php) { echo "active"; }; ?>"

Initial URL

Initial Description
This is a snippet to assign an active class to active links when the navigation is included in a php file.

Initial Title
Active links in included navigation

Initial Tags
php, navigation

Initial Language