Page 1 of 1

Include statement

Posted: Sat Jun 21, 2008 5:48 am
by RiSiCO
Hello, i have some problems with include statement.

I will show a graphic


*Root
--Home
---Folder
---Folder2
--Forum
---Folder1
---Folder2

In Home i have an index file and i want to include something from Forum Folder

I use

Code: Select all

<?php
include ('folder/file.php');
?>
But this work only for subfolders, how can i include something from upper folders?

Thank You!

Re: Include statement

Posted: Sat Jun 21, 2008 6:53 am
by Kieran Huggins
it works just like any unix file path:

Code: Select all

include ('../folder/file.php');
or better yet:

Code: Select all

include ($_SERVER['DOCUMENT_ROOT'].'/folder/file.php');

Re: Include statement

Posted: Sat Jun 21, 2008 9:10 am
by RiSiCO
Thank you, i will try :)