On Feb 26, 2007, at 11:22 AM, StainOnRug@xxxxxxx wrote:
Thanks alot for your response.. your information really was a help.
but now knowing that I an use a folder in my root DIR.. how do I
let PHP know where to look? For example the location lets say of
my include fold is www.example.com/files/include how do I
tell PHP to search that DIR? Thank you soo much! honestly!
I believe there is a way to either add paths or change the
include_path directive in your php script, you'll have to look in the
manual:
http://us3.php.net/manual/en/ini.php
I'm not too sure about it because I don't rely on the include_path
directive to locate my included files. I always give an absolute path
when I call them, just so I know for sure what I'm getting. To use
your example:
<?php
include '/files/include/foo.php';
// Do something with foo...
?>
instead of:
<?php
include 'foo.php';
// Do something with foo...
?>
there *could* be another 'foo.php' in the path that gets grabbed
before the one you want.
Or you can set a constant to the includes directory:
<?php
define('INCLUDE_DIR', '/files/include');
include INCLUDE_DIR.'foo.php';
// Do something with foo...
?>
By setting a constant to the directory, if you change the location of
the directory, then you only need to change the script in one spot
instead of hunting for all the include calls. Of course if you're
working with someone else's code and *they* are relying on
include_path being set correctly then you're pretty much stuck with
that, unless you want to rewrite their code.
Ed
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php