Discussion:
Absolute and relative paths ..... a quick explanation required
Kevin McGinley
2003-07-28 13:52:11 UTC
Permalink
Hi all,
can anyone tell me how php paths are worked out Im just starting to use
php over asp so would appreciate the answer to the following

If a file a.php includes a file b.php which includes a file c.php is the
include in file b.php relative to itself or the file that included it i.e.
a.php.


Any help appreciated
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Marek Kilimajer
2003-07-28 14:05:04 UTC
Permalink
relative to a.php
Post by Kevin McGinley
Hi all,
can anyone tell me how php paths are worked out Im just starting to use
php over asp so would appreciate the answer to the following
If a file a.php includes a file b.php which includes a file c.php is the
include in file b.php relative to itself or the file that included it i.e.
a.php.
Any help appreciated
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Curt Zirzow
2003-07-28 14:59:51 UTC
Permalink
Post by Kevin McGinley
Hi all,
can anyone tell me how php paths are worked out Im just starting to use
php over asp so would appreciate the answer to the following
If a file a.php includes a file b.php which includes a file c.php is the
include in file b.php relative to itself or the file that included it i.e.
a.php.
php looks for files base on your include path setting in php.ini.
I'm assuming your on windows so it defaults to:

include_path = ".;c:\php\includes"


Now going from that, php will first look for:

.\c.php and .\b.php

relative to where a.php is located.


Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Marek Kilimajer
2003-07-28 17:24:35 UTC
Permalink
use require_once() or include_once() - these remember what has been
included and do not include files that has been already.
Can u tell me then how its posssible to include a file that inculdes
another file if it is itself included in two other files that are in
difeerent direcrories i.e.
|\(root)a.php
|
|__ (dir b)\b.php
|
|__ (dir c)\ c.php
|
|__ (dir d) \ d.php
if c.php includes d.php and both a.php and b.php iclude c.php
how do u ensure that includes work. I know this can be done by designing
everything from the top down and ensuring the system is correct but at
the mo Im working on an existing system ??
B.T.W Thanks for your previous answer
Post by Marek Kilimajer
relative to a.php
Post by Kevin McGinley
Hi all,
can anyone tell me how php paths are worked out Im just starting
to use php over asp so would appreciate the answer to the following
If a file a.php includes a file b.php which includes a file c.php
is the include in file b.php relative to itself or the file that
included it i.e. a.php.
Any help appreciated
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Continue reading on narkive:
Loading...