chris9902
02-03-2004, 05:25 AM
when displaying this script it shows a breadcrumb but it also displays the page name you are on.
how do i make it not display the page i am on only everything before it like on www.macromedia.com
<?
$def = "index"; //default web page for directories on your server.
$dPath = $PHP_SELF; //Get the script path, relative to web root.
$dChunks = explode("/", $dPath); //Separate out folder and file names by looking for slashes.
?>
<a class="dynNav" href="/">Home</a><span class="dynNav"> / </span>
<!-- make a leading "home" link -->
<?
for($i=1; $i<count($dChunks); $i++){ //PHP arrays are 0 inxeded but we are skipping the first element
//because of the way explode() works.
echo("<a class=\"dynNav\" href=\"/"); //Make each chunk a link.
for($j=1; $j<=$i; $j++){ //Subloop to create the path for each chunk.
echo($dChunks[$j]); //Write each piece of the chunk's path.
if($j!=count($dChunks)-1) echo("/");//If that piece was a folder name, append a slash.
}
if($i==count($dChunks)-1){ //If the chunk is a file, not folder name...
$prChunks = explode(".", $dChunks[$i]); //take out the file extension...
if ($prChunks[0] == $def) $prChunks[0] = ""; //don't display the filename
if it's index or whatever default you specified.
$prChunks[0] = $prChunks[0] . "</a>"; //add the closing tag.
}
else $prChunks[0]=$dChunks[$i] . "</a><span class=\"dynNav\"> / </span>";
//Otherwise, just use the chunk name, close the a tag and add a paddeslash for disply.
echo('\"\>');ay. echo('\"\>');
echo(str_replace("_" , " " , $prChunks[0])); //Finish writing the link, replacing underscores with spaces for the end user.
}
?>
how do i make it not display the page i am on only everything before it like on www.macromedia.com
<?
$def = "index"; //default web page for directories on your server.
$dPath = $PHP_SELF; //Get the script path, relative to web root.
$dChunks = explode("/", $dPath); //Separate out folder and file names by looking for slashes.
?>
<a class="dynNav" href="/">Home</a><span class="dynNav"> / </span>
<!-- make a leading "home" link -->
<?
for($i=1; $i<count($dChunks); $i++){ //PHP arrays are 0 inxeded but we are skipping the first element
//because of the way explode() works.
echo("<a class=\"dynNav\" href=\"/"); //Make each chunk a link.
for($j=1; $j<=$i; $j++){ //Subloop to create the path for each chunk.
echo($dChunks[$j]); //Write each piece of the chunk's path.
if($j!=count($dChunks)-1) echo("/");//If that piece was a folder name, append a slash.
}
if($i==count($dChunks)-1){ //If the chunk is a file, not folder name...
$prChunks = explode(".", $dChunks[$i]); //take out the file extension...
if ($prChunks[0] == $def) $prChunks[0] = ""; //don't display the filename
if it's index or whatever default you specified.
$prChunks[0] = $prChunks[0] . "</a>"; //add the closing tag.
}
else $prChunks[0]=$dChunks[$i] . "</a><span class=\"dynNav\"> / </span>";
//Otherwise, just use the chunk name, close the a tag and add a paddeslash for disply.
echo('\"\>');ay. echo('\"\>');
echo(str_replace("_" , " " , $prChunks[0])); //Finish writing the link, replacing underscores with spaces for the end user.
}
?>