> Is there anyway that i can get a url relative to my server 
> for a script that is being run??
> 
> The script is being included in mulitple files and 
> $_SERVER['SCRIPT_NAME'] just gives me the name of the file 
> that is including the other scripts.
> Also $_SERVER['SCRIPT_FILENAME'] is returning nothing.

I'm not completely sure I know what you're after.  If you're looking to get
the http path to an included file, this should work:

<?php

$http_path = "http://"; . $_SERVER['SERVER_NAME'] .
             str_replace( $_SERVER['DOCUMENT_ROOT'], "", __FILE__ );

?>

If you're in windows I don't think the replace would work, because the
docroot's slashes go one way and the __FILE__ slashes go the other.  You'd
use something like strtr( __FILE__, "\\", "/" ) before the replacement to
fix that.

Cheers,
Rick


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to