View Single Post
Old 03-04-2008, 07:42 PM   #3 (permalink)
Gareth
The Acquainted
 
Gareth's Avatar
 
Join Date: Jan 2008
Posts: 136
Thanks: 4
Gareth is on a distinguished road
Default

Say you have the following file / folder structure:

[Main Folder]
+ index.html
+ include.html
+ image.gif

[Sub Folder]
+ sub.html

[Includes Folder]
+ another.html



In sub.html

To access include.html you would do the following:

PHP Code:
require_once("../include.html"); 
As you would in html

Code:
<img src="../image.gif" alt="bla" />
The two periods (.) mean that you are going a directory back (ie one . would mean you are in the same directory, two . would mean you go back one, three . would be going back two directories).

To access another.html in sub.html

You would have to go back a directory, then forward another one. Ie:

PHP Code:
require_once("../includes/another.html"); 
Alternatively you could use require(), include() and include_once().

Hope this helps

Gareth
Gareth is offline  
Reply With Quote