Re: order of include on include()
| From: | Richard Lynch | Date: | Thu, 15 Jun 2006 06:15:45 +0000 |
| Subject: | Re: order of include on include() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238027@lists.php.net to get a copy of this message | ||
On Wed, June 14, 2006 3:23 pm, blackwater dev wrote:
> If I have a file:
>
> /code/folder1/test.php
>
> and in that file, it has these includes:
>
> include_once("../../file1.php");
> include_once("../../file2.php");
> include_once("../../file3.php");
../ is just gonna give you headaches, sooner or later.
Just fix your include_path and be done with it.
> I then have another file:
>
> /code/test2.php
>
> That file pulls in test.php.
>
> include_once("folder1/test.php");
>
> Why do I get errors on the includes?
I don't think include_once is THAT smart...
Or maybe it just assumes you are using include_path in a sane way and
not doing this in the first place... :-)
include and include_once have nothing to do with the current file.
They ONLY look at your include_path.
Your include_path MIGHT (and probably should, in many applications)
have '.' as one of the directories in it.
But even then, I believe '.' simply means current working directory,
so unless you are dinking around with http://php.net/chdir (which
you
probably shouldn't, usually) then it's just gonna be the ONE directory
of the very first PHP file loaded, no matter where all the other files
are.
Hope that helps.
--
Like Music?
http://l-i-e.com/artists.htm