[thelist] tip (a little late)

Dave Stevens stem at stemofficial.co.uk
Sat Mar 30 16:48:01 CST 2002


Should have done this in my last email, sorry...

<tip type="Including in PHP" author="Dave Stevens">
If you are including a file (let's call it "one.php") within another one
(let's call this one "two.php") using PHP's include() function, and then
want to include another file ("three.php") in two.php, you may run in to
problems.

The include() function will only allow you to include files with a path
relative to one.php (in this case), so if you are including three.php in
two.php, make sure you include() it with its path relative to one.php.

If one.php is in the root directory, two.php is in sections/two.php and
three.php is in global/three.php, when you include three.php in two.php use

include("global/three.php");

and the include will work as planned.
</tip>

Hope that makes sense...

Dave Stevens




More information about the thelist mailing list