JavaScript Multiple Slideshows
SMTP FormMail Script with Attachments
Pre-Populate Forms with Javascript
Server Side Includes are a powerful tool for webmasters hosted by systems
using the Apache server software. It allows you to add intelligence to your webpages without
having to rely on client-side browser capabilities, but it can also easily be used even by
non-prorgammers to insert the content of external files into your webpages.
The contents of the menu seen below on the left is actually stored in a separate HTML file.
You can update the navigation on your whole site, just by editing this single external file.
Its even easier than using frames because you don't have to worry about the TARGET attribute,
and you can add links to pages outside your own site without having to worry about them
loading inside your frameset.
To impliment Server Side Includes, you need to be on an Apache-based server. To check
which software is running on the server that hosts your site, use
my Server Response Header Checker and enter
the URL for your website. The information returned by your server will include the name of the server
software. If it mentions 'Apache', you're in business. If it mentions Microsoft, you'll need to investigate
the tools they make available.
If you are running on an Apache-based server, you can proceed. You just need to make sure that your pages will be pre-scanned by the Apache server software for server directives before they are sent to the user. Ordinarily, Apache will only scan pages that use the '.shtml' file name extension. But you can add an '.htaccess' file to the root directory of your site and include an instruction that will tell Apache to scan other file types. I recommend adding the following lines to your new or existing .htaccess file:
Options +Includes
Options +FollowSymLinks
AddHandler server-parsed .htm .html
This code tells Apache two important things: (1) Enable Server Side Includes, and
(2) Scan files ending in either '.htm' or '.html' for server directives.
Then you can add the directive to include your menu file by adding the following code to your HTML pages:
<!--#include virtual="menu.html" -->
That's all. Just change the filename to the one you use for your HTML file that contains the code for your menu and upload it all to your site.
This page was last modified on August 27, 2020