Server Side Includes are enabled on our web hosting server, and these let you add a great deal to your web pages if your web site is hosted with us.
You embed the desired command into your HTML page, when this page is requested our web server replaces the embedded command in your HTML source with the output of the command.
For example, in this web page the following command is embedded into the HTML source:
If you look below, you will see the output of this command as it appears on this web page:
|Saturday, 20-Dec-2014 05:06:04 GMT|
This is a simple and very effective way of putting the date and time into your web page and as you can see, the command is hidden from the audience with only the output of the command appearing on the web page.
You can alter this command to change the date format and various other aspects to get a result most appropriate to your web page.
You can also dynamically add the 'Last Modified' date of a file to a page as well, use the following command:
The output of this command on this web page is:
|Friday, 25-Jul-2014 12:54:28 BST|
Another great feature of SSI is the ability to place a text file within your web page, such as a HTML file for instance.
I have a text file which is a simple HTML document called "insert_1.html" in my directory, by putting the following command into my web page:
The file "insert_1.html" is placed into this webpage as though it were written in the HTML directly:
Text from an external file
You can have one text file (a page header or footer is a typical and common use) that appears on several pages throughout your site. If you need to update this, you only have to update one single file and all other pages which use this file (through the "#include" command) will reflect the changes you have made.
Because SSI works on the server and not the clients' browser, you do not need to worry about compatibility with different browsers and operating systems.
If you want one of your web pages in your web hosting space to use Server Side Includes, you must call the file .shtml and not just .html. By calling the file .shtml, the server knows it contains Server Side Includes and will process the file accordingly.