This is tricky to explain, so bear with me please.  I have a file like:

c:\htdocs\project_bunny\includes\config.php

In my browser address bar, this would look like:

http://localhost/project_bunny/includes/config.php




If within this document (i.e. config.php), I had:

<?php
//config.php

define("CONFIG_FILE", __FILE__);

echo CONFIG_FILE;       //this will return
"c:\htdocs\project_bunny\includes\config.php"

?>

Now, if I have another file (e.g. rabbits.php):

<?php
//rabbits.php

include("config.php");

echo CONFIG_FILE;       //this will also return
"c:\htdocs\project_bunny\includes\config.php"

?>

This is all great up to this point.  What I'm trying to do is:

<?php
//config.php

define("CONFIG_FILE_URL", __URL__);

echo CONFIG_FILE_URL;   //would return
"http://localhost/project_bunny/includes/config.php";

?>

So no matter what file I use (like rabbits.php) and I include config.php,
CONFIG_FILE_URL will always return the url for the config file and NOT the
file doing the calling (rabbits.php).

Sorry for the longwinded explanation.  I hope someone can help!  Thank you.

-m

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

Reply via email to