The way I do this is to get the current page name and then use it to determine which style is applied to the link (and, indeed, remove the anchor so there is no link to the current page).
PHP Code:
$url = basename($_SERVER['PHP_SELF']);
That assigns the current page name to the variable $url. Then for each link in your navigation, you can use an if/else statement to show the correct item. For a homepage link in an unordered list, this might look like this:
PHP Code:
if ($url == index.php) {
echo '<li class="active">Home</li>';
} else {
echo '<li><a href="index.php">Home</a></li>';
}
You're then free to style the item corresponding to the page your on however you want using CSS.
- Adam