SSI – Server Side Includes is a really nice thing! I am in the process of updating my site. I use dreamweaver and notepad++ to edit my site. Which means that sometimes I am unable to use a template properly. In this case, I edited some of the pages with notepad and didn’t realize it was part of the template. During the process of editing I realized I had many small mistakes that needed to be corrected. This left me with very few choices.
- Redo the template and attach the pages to it again
- Edit each page manually
- Find something that is like a template
I found option 3 with a google search. In fact, the site that worked the best for me was Easy Web Tutorials.com. It lays it out very easily for me to understand. In a nutshell, I can create another web page with the code on it and then call that page from another page. This works great for headers, footers and menus. Change 1 item and all the pages changed. It says that the pages should use a special extension of either .shtml or .shtm. However, it also says one can use .html or .htm if you edit the .htaccess file. I chose this last option and added this line to my .htaccess file: “AddHandler server-parsed .html .htm”
This brings me to the part of how do I call this code in another webpage? The first thing I tried was my footer. So in this instance I would have to type in <!–#include virtual=”footer.html”–> where I wanted the code to go. There is another way to use SSI which can include the output of a cgi script.
The article does state that not all hosting companies support server side but I think it is an apache function which means most do.