Return to Snippet

Revision: 6286
at May 14, 2008 14:05 by iTony


Initial Code
<?php
function setBodyId() {
    $path = $_SERVER['REQUEST_URI'];

    if(!isset($bodyId)) {
		if(eregi(’^/about/’,$path) == 1) {
			$bodyId = ‘about’;
		} else if(eregi(’^/blog/’,$path) == 1) {
			$bodyId = ‘blog’;
		} else if(eregi(’^/contact/’,$path) == 1) {
			$bodyId = ‘contact’;
		} else if(eregi(’^/work/’,$path) == 1) {
			$bodyId = ‘work’;
		} else if(eregi(’^/play/’,$path) == 1) {
			$bodyId = ‘play’;
		} else if ($path == ”) {
			$bodyId = ‘home’;
		} else {
			$bodyId = ‘general’;
		}
	}

    return $bodyId;
}

$bodyID=setBodyId();
?>

<body id="<?=$bodyID?>">

Initial URL


Initial Description


Initial Title
simple Body ID Function

Initial Tags
simple, function, body

Initial Language
PHP