Page 1 of 1

PHP Include

Posted: Fri Nov 02, 2007 2:50 pm
by spacebiscuit
Hi,

I am having some trouble using php include function.

Please consider the following directory structure:

I have a php script in the following directory:

res/common/

The file I am trying call via the include function is in the following directory:

includes/

I am calling the file as follows:

Code: Select all

include("includes/menu.php")
This does not work so I have also tried:

Code: Select all

include("../../includes/menu.php")
The only way I can get it to work is as follows:

Code: Select all

include("http://www.mydomain/includes/menu.php")
It seems odd that I can only call the function successfully if I use the domain name.

Any thoughts?

Thanks,

Rob.

Posted: Fri Nov 02, 2007 2:58 pm
by Kieran Huggins
try:

Code: Select all

include($_SERVER['DOCUMENT_ROOT'].'includes/menu.php');