Re: [PHP] order of include on include()

2006-06-15 Thread Richard Lynch
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

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



[PHP] order of include on include()

2006-06-14 Thread blackwater dev

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


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?  Does php first pull in the includes of
test.php before pulling it into test2.php?  It seems to be looking for the
includes in test.php from where I am in test2.php and is failing.

Thanks!


RE: [PHP] order of include on include()

2006-06-14 Thread Jay Blanchard
[snip]
Why do I get errors on the includes?  
[/snip]

Includes are included in the order of their inclusion. If an include
includes a child function (such as a class declaration) its parent must
be included first.

What error did you get? My bet is it is a path issue.

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