Using SSIs with PHP?

Hey,

I recently created a form on my website, but the problem is, I can’t get the SSI function to work with PHP. My site currently uses SSIs for both the header and footer of the site, however the pages are all .html, so I have not had a problem until now. Also, the other issue is that this form is in a subfolder on my website, so I am having trouble trying to point it back to the main directly where the images and header/footer.html files are being held.

So basically, my site has the majority of its files (index, etc) in the main directly, but this new form is in a new directly (Let’s say…/website/folder/form.php for example). The issue is, that I need it to point back to the main directly where the header and footer are (/website/header.html)

I have been trying different codes such as;


<?php include("../header.html"); ?>

or


<?php virtual("../header.html"); ?>

Nothing seems to be able to connect it back to the main directly where the file is being held.

Is it even possible or am I just simply doing some dumb little mistake?

Any help would be greatly appreciated

Thanks,

Elementax

Assuming php is set to run on your .html pages, just use this for all your links (no matter where they are in the site structure):

<?php include $_SERVER["DOCUMENT_ROOT"] . "/header.html"; ?>

This setup is handy for linking to a file from anywhere in your site. For example, if you had folder called /includes/ inside your root folder, containing a file called footer.html, you could access that file from anywhere in your site structure with the one same link:

<?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/footer.html"; ?>

For some reason, it still doesn’t work, Do I need to enter a value for “DOCUMENT_ROOT” or is that just pointing it to the root directly?

I used the first code and copied that exactly, but nothing. ;/

Actually, just try this (I think I made a mistake above :blush:):

<?php include $_SERVER["DOCUMENT_ROOT"] . "header.html"; ?>