RE: [PHP] "you are here" monitor?
| From: | Matt Williams | Date: | Tue, 12 Dec 2000 09:07:47 +0000 |
| Subject: | RE: [PHP] "you are here" monitor? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29844@lists.php.net to get a copy of this message | ||
>
> I think I saw a script that will keep a running tab of what directory/site
> area the user is in, e.g.
>
> home > section > subsection > page
>
> and allow them to be hot links.
>
> I cannot find this anywhere - can anyone point me in the right direction?
>
Hi Andrew
This normally works for me
---------------------------
// This function will show the path by directory
function show_path() {
global $SERVER_NAME;
global $PATH_TRANSLATED;
global $SCRIPT_NAME;
// _path_info.php3
// This script is used to call the path directory listing throughout the
site
// Return the Script name as an array for the path menu ie. home :
subjects : etc.
// Get rid of everything apart from the file name
$dir = substr(strrchr ($SCRIPT_NAME, "/"), 1);
// Remove the file name from the scriptname by replacing the filename with
$path = str_replace("$dir", "", $SCRIPT_NAME);
// Remove the first and last /
$path = substr("$path", 1, -1);
// Print out the link as it should be
// The href should be the full path but the name should be only the dir
echo "<a href=\"/\">Home</a> > ";
if($path != "")
{
// Return the path as an array by spliting at /
$path = split( "/", $path);
if(sizeof($path) != 0)
{
$start = 0;
$stop = count($path);
for ($i = $start; $i < $stop; $i++) {
print "<a href=\"/";
for ($j = $start; $j <= $i; $j++) {
print "$path[$j]/";
}
print "\">".ucfirst($path[$i])."</a> > \n";
}
}
}
--------------------------------