SSI tutorial
Do you have a website, and you would like add a menu / navigation bar on every page? Well, there are a few options, you can use ugly frames (which many people don't like) or you can add a navigation bar on every page. But if you would like to change it, you have to edit ALL the pages. Which is OK if you have a 5 page website, but once it starts to grow and you get 15 or more pages, it can prove to be quite the hassle! (I did the mistake of doing that ^^')
BUT! I can tell you a little secret of mine..... I can teach you a magical amazing thing, that lets you edit once file and it will instantly, magical show up on all of your pages! What is this you ask? Well, it is SSI, Server Side Includes. (It is an alternative to the PHP include - if you don't know what that is, well it doesn't matter).
BUT you cannot use SSI with things that generate the HTML code for you, such as 'simple sight builders' You have to use 'solid HTML' and know how to edit HTML files
1. MAKE SURE YOUR HOST SUPPORTS SSI! If you don't know have a look at their 'features' page, or their FAQ or contact customer support.
2. First of all you need to build a layout.
3. You need to separate the HTML.
Take the HTML from the top of the page to your content, put it into a file called 'top.txt', make sure you include everything, including the <html><head> tags. Now, take everything from the end of your content to the very bottom, right to the </html> tag. Put it into a file called 'bottom.txt'
Confusing? Well here is a little diagram of a layout.
|
Banner |
||
| left nav | content | right nav |
|
footer |
||
top.txt should contain only the blue bits of the diagram the banner and left navigation. bottom.txt should contain the pink bits, the right navigation and footer. I hope this helps.
4. now we get onto the fun stuff, the SSI. Make a page named whatever.shtml and add the following code, editing where needed.
On the content page add
<!--#include virtual="top.txt"-->
[HTML of content here]
<!--#include
virtual="bottom.txt"-->
(if you have no right navigation and footer you may delete this).
5. Upload the pages to the internet. They should now work.
Editing the menu / navigation bar
Just edit top.txt ort bottom.txt, and the effect will appear on all of your pages which have the SSI code. Simple eh?
Trouble Shooting
Still not working?
Please contact me and I will try to sort it out ASAP.
















