Version: 1.0

Type: Full Script

Category: HTML

License: GNU General Public License

Description: Include for parent folder links



<?
//set the root of your site
$root="http://www.yoursite.com";

//take into a variable each path element
$url = explode("/", $PHP_SELF);

//define the block variable
static $block;

//count the elements and discard (-1) the last which is the file
$counter = count($url)-1;

//set internal loop counter value to 1 cause $url[0] is empty
$n=1;

//this prints out the home link (array $url[0] does not contain the root element, so we must create it manually
echo "<a href='".$root."'>home</a> > ";

//loop start
	while($n<$counter){
//get each element of the array...
	$toc =$url[$n];
//and recursively add the element to re-create the complete path
	$block=$block."/".$toc;
//print out the result
	echo "<a href='".$block."'>".$url[$n]."</a> > ";
//increment the counter
	$n++;
	}
?>