Does $PHP_SELF always get's the path of the document it resides in even if the 
document is an include?

I'm trying to set one of those breadcrumb path navigation scripts and I don't want to 
copy the
script to every directory, I just want to include it in my header.inc.

As a result I only get the home directory link that way.

I tryed using a variable like  $string=$PHP_SELF; then in the script I replaced the 
line:

$str=$PHP_SELF; with $str=$string; , but it turn out as an empty variable.

Here is the original unaltered php:

$site = "http://".$HTTP_HOST."/";; 
 //$site = "http://site.com";; 
 
$str=$PHP_SELF;

ereg("^(.+)/.+\\..+$", $str, $part); 
$str = $part[1]; 
$str = substr($str, 1); 

$label =  array("home"=>"Home",
"anunciate"=>"Anunciate", 
 "encuentreMedico"=>"Encuentre un Medico", 
 "anunciateHospital"=>"Anunciate Hospital", 
 "anunciateMedico"=>"Anunciate Medico", 
 "article"=>"Article", 
 "encuentreHospital"=>"Encuentre un Hospital"); 
 
if (ereg('/', $str)){ 
$arr = split("/", $str); 
$num = count($arr); 
for($i=0; $i < $num; ++$i){ 
echo(" > <a
href=\"". $site . $arr[$i] ."/\">".$label[$arr[$i]]."</a>"); 
$site = $site . $arr[$i] ."/"; 
} 
}elseif (ereg("[a-zA-Z_]{1,}$",$str)){ 
$arr = $str; 
echo(" > <a
href=\"http://".$HTTP_HOST."/".$arr."/\";>".$label[$arr]."</a>"); 
}else{ 
echo(""); 
} 

Thanks:

Gerry Figueroa
Dynamic Intermedia

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to