On Fri, 1 Mar 2002, Nick Wilson wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> * and then DL Neil declared....
> > > masterfile.inc lives in /var/www/includes/ and contains this line:
> > > include("/var/www/includes/anotherfile.inc");
> > >
> > > in index.php I include masterfile.inc and thus get anotherfile.inc.
> > >
> > > What I'd like to know though is, is it possible to have the include
> > line
> > > in masterfile.inc specify a url *relative* to itself?
> > > like:
> > > // masterfile.inc
> > > include("anotherfile.inc"); // now the path is relative.
> >
> >
> > AFAIK the options are absolute addressing, relative addressing (to the
> > php.ini), and http access.
> >
> > RTFM the four pages from
> > http://www.php.net/manual/en/function.require.php.; There's quite a bit
> > of advice/experience in the user annotations!
>
> Please don't RTFM me, that's the first place I went. I didn't find what
> I'm looking for so I came here.

I didn't catch the first part of this thread (rampant deletion ahoy) so
please excuse if I am talking nadgers.  The way I see it, if you are
calling includes/requires from within other includes, the path is that of
the script that makes the first include.  If that makes any sense.

So if you have a file called includes.php in your /home/webroot that
includes/requires files in a subdir called /home/webroot/stuff/ and those
files include/require other files within that same directory (such as
/home/webroot/stuff/class.cheese.php), then the includes would look like
this:

# index.php
include("includes.php");
.
.
.
.

# includes.php
include("stuff/dbstuff.php");
.
.
.
.

# stuff/dbstuff.php
include ("stuff/class.cheese.php");
.
.
.
.

Am I making any sense? :-)

Regards,

Nick Winfield.


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

Reply via email to