PDA

View Full Version : Server Side Includes


ecampsite.co.uk
10-13-2005, 07:59 PM
Hi there.
I currently have a problem regarding server side includes.
My site is purely html, and at the top of these html pages there is a large chunk of code that is the same on every page. If i change something in that code it means having to change every single html page which is very tedious. I heard about SSI and wondered whether i could put some text (the code that is the same on all the pages) in a file, and just change that file if i change it. Then all of the pages will have changed after making just the one change!!
If anyone could point me in the right direction for this and tell me if this is the right thing, i would be extremely grateful!!!
Thank you
Craig

Horus_Kol
10-14-2005, 02:39 AM
well... the simplest form is to just use:


<!-- #include "includes/common.inc" -->


any HTML in the "common.inc" file should be spat out at the point at which you include it in the page....

welshsteve
10-14-2005, 06:29 AM
I'm trying to do this with a word document. Do I need to save the word doc as a html file then rename the extension to inc ?

welshsteve
10-14-2005, 06:44 AM
No matter what I try, I just cannot get this to work :(

Horus_Kol
10-14-2005, 07:40 AM
d'oh... sorry... i haven't really done SSI like that before (I work in PHP mostly, but you need a server that supports that)...

firstly, the include command I gave you is wrong - it should be:

<!-- #include file="includes/common.inc" -->

second, change the extension of your page file to .shtml - this should instruct the server to use SSI

finally - stop using word! it's an awful editor...

welshsteve
10-14-2005, 08:16 AM
Thanks for that, I've tried it but it doesn't work :( I'll just have to tell that I will manually code the page whenver he updates his word document.

For the record, I don't use word :D I use notepad mainly, but just started using notepad2 :) I'm designing a departmental intranet site at work. My line manager wants to manually update a word document (only tech skills he has) so that when he saves it, it automatically updates his area on the website. This is why I need to include a word document on a web page. I want to make things as easy for him as possible. This way I don't have to code his word doc in html everytime he updates it.