[PHP] Re: \|/ $PHP_SELF

2001-11-20 Thread Gerry Figueroa Anadon

Any Ideas as to how I could be able to acomplish this?
or 
How could I get the path of the main page and pass it on to the included file for 
processing?.

thanks!

Fred wrote:

> $PHP_SELF will always give the name and path of the main file, even if the
> variable is set in an included file.  The reason is that the included file
> is included before the variable is evaluated.
> 
> Fred

-- 
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]




[PHP] \|/ $PHP_SELF

2001-11-19 Thread Gerry Figueroa Anadon

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(" > ".$label[$arr[$i]].""); 
$site = $site . $arr[$i] ."/"; 
} 
}elseif (ereg("[a-zA-Z_]{1,}$",$str)){ 
$arr = $str; 
echo(" > http://".$HTTP_HOST."/".$arr."/\";>".$label[$arr].""); 
}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]