Re: best way to properly build an include path *regardless* from where I am calling the include?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 6, 2009 at 8:24 AM, Daniel Brown<parasane@xxxxxxxxx> wrote:

>    Conversely, using the code example from above (and building upon
> it), we know that __FILE__ remains static regardless of the point of
> the call.  Thus, it's a better and more reliable method, and is usable
> even if $_SERVER data is not available to the script.

+1 - i use dirname(__FILE__) everywhere. Rasmus said "you can just use
./includes/foo.php, why have an extra function call" (the dirname) but
i tried that on one of my setups and what is odd is it couldn't find
the files from the forced relative paths which should work just fine.
there could have been other weird voodoo going on too, but i know for
a fact dirname(__FILE__) has been reliable and the best part is it
does not require $_SERVER.

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux