Try this:
PHP Code:
<html>
<body>
<?php
switch( $_SERVER['REQUEST_URI'] )
{
case '/about.html' : $selected = 'ff0'; break;
case '/blog.html' : $selected = '0ff'; break;
case '/contact.html' : $selected = 'f0f'; break;
case '/terms.html' : $selected = 'f00'; break;
case '/subscribe.html' : $selected = '090'; break;
default : $selected = '000';
}
$selected = 'style="background-color:#' .$selected .'"';
?>
<div <?php echo isset($selected) ? $selected : NULL;?> >
...
...
</div>
</body>
</html>
Beware: All Apache Versions are not the same. If on the off-chance $_SERVER['REQUEST_URI'] does not return the value expected then try this script:
PHP Code:
echo '<pre>';
print_r( $_SERVER );
echo '</pre>';
die;
Bookmarks