Return to Snippet

Revision: 10042
at December 4, 2008 16:37 by relaxasaurus


Updated Code
/*
Directory = $thisSection
Page file name = $thisPage
*/

$parts = Explode('/', $_SERVER["SCRIPT_NAME"]);
$thisSection = $parts[count($parts) - 2];
$thisSection = ($thisSection == "") ? "home" : $thisSection;
$thisPage = end($parts);
$thisPage = str_replace(".php","",$thisPage);

// From there you can do things like:

function subnav($name,$page) {
	global $thisPage;
	if($thisPage==$page) {
		echo '<li class="active"><a href="'.$page.'.php">'.$name.'</a></li>';
	} else {
		echo '<li><a href="'.$page.'.php">'.$name.'</a></li>';
	}
}

if($thisSection=="about") {	
	subnav("About Us", "about");
	subnav("History", "history");
	subnav("Contact Us", "contact");	
}

Revision: 10041
at December 4, 2008 16:09 by relaxasaurus


Initial Code
$parts = Explode('/', $_SERVER["SCRIPT_NAME"]);
$thisSection = $parts[count($parts) - 2];
$thisSection = ($thisSection == "") ? "home" : $thisSection;
$thisPage = end($parts);
$thisPage = str_replace(".php","",$thisPage);

Initial URL


Initial Description
Directory = $thisSection.  Page file name = $thisPage.

Initial Title
Assign Section and Page IDs

Initial Tags


Initial Language
PHP