This website uses clean URLs, so they always look like /services/, /services/webdesign/, /contact/, etc. Each main section can have more subpages. Therefore I couldn't use the page_ID.
Code: Select all
<?php
// only allow specific set of sections
$allowed_sections = array('home','services','portfolio', 'weblog', 'about', 'contact');
// the URLs look like /portfolio/ , /contact/, etc
$request_uri = $_SERVER["REQUEST_URI"];
$parts = explode(DIRECTORY_SEPARATOR, $request_uri);
if(in_array($parts[1], $allowed_sections)) {
$section = $parts[1];
} else {
$section = 'home';
}
// Then, in the template for the header section of all pages:
echo '<body id="' . $page_ID . '" class="' . $section . '" >';
?>Code: Select all
#navbar {background:transparent url(images/navbar.gif) 0 0 no-repeat;}
.services #navbar {background-position: 0px -28px;}
//etc