Can you include a file that is up and then down a directory?
Posted: Mon Jun 25, 2007 3:07 pm
Can you include a file that is in another directory at the same level?
This example shows FOLDER A as the top folder which contains 2 folders FOLDER 1 and FOLDER 2.
I have some php files (file1.php and file2.php) in FOLDER 1 and would like to include the inculde.php file (which is in FOLDER 2) into file1.php and file2.php.
Is there a way of doing this without using this style of include. Can it be done using this style ?
FOLDER A (htdocs)
|
|
-----FOLDER 1
| |
| |------file1.php
| |------file2.php
|
|
-----FOLDER 2
| |
| |------include.php
|
|
|----OTHER FILES
This example shows FOLDER A as the top folder which contains 2 folders FOLDER 1 and FOLDER 2.
I have some php files (file1.php and file2.php) in FOLDER 1 and would like to include the inculde.php file (which is in FOLDER 2) into file1.php and file2.php.
Is there a way of doing this without using this
Code: Select all
include($_SERVER['DOCUMENT_ROOT'].'FOLDER 1/include.php');Code: Select all
include ("../FOLDER 2/include.php");FOLDER A (htdocs)
|
|
-----FOLDER 1
| |
| |------file1.php
| |------file2.php
|
|
-----FOLDER 2
| |
| |------include.php
|
|
|----OTHER FILES