Point Dogbark.com >> How To >> Programming >> Server Side Includes (SSI)

Server-side includes (also referred to as SSI) are instructions within a web page that direct the server to "include" another file in the serving and display of the page. Hang on - this is going to get messy.

Why use server side includes?

There are a lot of reasons to use includes. We use them on our site for the part of a page that is consistent from page to page. See the bar at the top and the side navigation? That's an include. This means that if we decide to change the text on the side we can do it on one file instead of having to do it on every single page.

Step by step instructions

The actual steps will vary, depending on what software you use to design your site, but process is the same.

1. Create the "included" file. This will be an .html file.
2. Insert the include reference in the destination page. This step will vary, depending on your HTML editor. The actual HTML code for the include will look like this:

<!--#include virtual="/include/collie/gracie.html"-->

Note: some editors may not display the included file in the destination page, as the included file is not actually part of the page. Also, in order to edit the included file, you will need to open it separately; no changes can be made from within the destination page.

3. Save the destination file as as .shtml. The "s" tells the server to look for include-instructions in the page.
4. Upload both the webpage file and the included file.
5. Go outside and play. You deserve a break, and your dog is probably begging for a walk.