Hi all,

Bare with me as I'm very new to php but this issue should be easy for the gurus.

So, I have a dynamic web template which has an 'include' command reference to two files located in a folder called 'includes' at root/includes/ to create a common header and footer to all pages that this template is applied to. Within the dynamic web template, which sits in the root of the site, are the lines

<?php
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/includes/ztest_hinclude.php";
include($path);

?>

for the header and

<?php
$path = $_SERVER['DOCUMENT_ROOT'];
$path .= "/includes/ztest_finclude.php";
include($path);

?>

for the footer.

If I apply this dynamic web template to any page in the root of the site, any hyperlinks to pages contained within the referenced files to be included are correct (e.g. the link to the home page shows as root/index.php)

However, if I create a folder in the root, call it 'myfolder' for example, save a php file into that folder and apply the dynamic web template to it, the links referenced in the two files to be included are incorrect (e.g. instead of pointing to the home page at root/index.php it points to root/myfolder/index.php which is clearly wrong).

The two include statements above have been sourced from the web and this seems to be the acccepted method of determining the root of the site so I can't understand quite where I've gone wrong. Any advice would be much appreciated.