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 06, 2009 at 07:15:03PM -0600, Govinda wrote:

<snip>

>
> Dan I love to see smart hacks in action!  ..and I believe I get what
> you are doing.
> I am just amazed that there is not a SIMPLE (one-liner) reliable way
> of just saying "document root" without a complex function like that.
> I mean what we need here is a global include path for the shared-
> hosted user ..  an include_path that can be set for the virtual server
> user and it 'sticks' (does not have to be set on every page load).
>  I think I'll let this all go for now...  I have a lot of basics to
> cover before I trip out too much in any one area.  I'm going to need
> the time and brain juice for some 'real' issues later  ;-)

I'm not sure how this could be made simpler.

$site_root = realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR;

Call that in any file in the root of *your* web directories, and you
have what is essentially the "document root" for *your* site.
Presumably, you know the *relative* directories of all your files.
Simply append those relative directories + filenames to the $site_root
variable, and you're done.

Paul

-- 
Paul M. Foster

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