Originally posted on the Steel Dolphin Forum a long long time ago.
Many of you know how to use Server Side Includes, and PHP/ASP. I am going to go over a few uses of these that make your life easier. You do not need to already know how to use these though.
The first rule to making your life easier as a web designer is changing as few files as possible when you need to make a change. That is why we use a separate CSS and JavaScript file, right? This all can be applied along with one of the philosophies behind XML, keep style separate from content.
This is very easy to do with Server Side Includes. How? Here’s the steps. (Your web server must support Server Side Includes)
1. Create your main page for your site as you normally would.
2. Create three html files from that one file, a header, footer, and a file with all of the content (by content I mean the stuff that will change from page to page, like text). The header will contain everything from the first HTML tag to just before where the content begins. The footer will contain everything after the content to the closing HTML tag. And whats left is your content page.
I would name the pages header.html, index.shtml, and footer.html. Notice how the file extension of the index page is SHTML? This will tell the server to scan that page for includes before displaying it.
3. On the first line of index.shtml, insert the following tag,
<!--#include virtual="header.html" -->
and on the last line, insert the following,
<!--#include virtual="footer.html" -->
4. Upload to the server and open index.shtml.
5. Create all of your other pages and use these same tags at the beginning and end, then if you need to change the site in a major way, just edit the header and footer files. Be sure to save each file with the extension “shtml”
That’s it, this will make your life easier. There are drawbacks to this though, it will not be easy for you to change your page Titles, or other things usually found at the top of the HTML file. For this you need a server side scripting language like PHP. I will post Pt. 2 with PHP to make your life even easier in a few days.