Re: Nested includes - Relative paths?
| From: | Richard Lynch | Date: | Wed, 08 Nov 2006 17:16:43 +0000 |
| Subject: | Re: Nested includes - Relative paths? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-244385@lists.php.net to get a copy of this message | ||
You can save yourself a LOT of headaches by utilizing the ever-popular
'include_path' feature so you never have to put any kind of directory
info into your include statements.
http://php.net/include_path
On Tue, November 7, 2006 9:50 pm, Nuno Vaz Oliveira wrote:
> Hi All,
>
> I'm relatively new to PHP but I've had some training and feel quite
> confortable
> programming it...
>
> Anyway, I'm having a problem in understanding the correct behaviour of
> the
> include statement/function.
>
> Imagine that I have an INDEX.PHP file in my root directory and I want
> to
> include the file INCLUDE\SESSION.PHP. I would use the statement:
>
> <?php include 'include/session.php'; ?>
>
> What if, inside the file INCLUDE\SESSION.PHP I want to include the
> file INCLUDE\DATABASE.PHP?
>
> Should I use the statement:
>
> <?php include 'database.php'; ?>
>
> because DATABASE.PHP and SESSION.PHP are in the same directory or
> should
> I use the statement:
>
> <?php include 'include/database.php'; ?>
>
> because INCLUDE\SESSION.PHP is going to be included in INDEX.PHP witch
> is
> NOT in the same directory of DATABASE.PHP?
>
>
> In other words... When PHP processes an include statement does it
> include
> the file where the include statement is and then process its contents
> (eventualy
> including other files) or does PHP processes the file to be included
> and
> only includes it after that?
>
> Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?