Server side includes tutorial

Server side include (SSI) is a very simple programing language which allows to perform just a few tasks, but they are also very important and useful. In this small tutorial I will include  only a few tasks performed by SSI, which may be also used in ASP pages.

A page which uses SSI (but not ASP) will have ".shtml" or ".shtm" extension. When using ASP the extension used must be ".asp".

SSI pages are very similar to html pages, but they will include some special components and within then will be located the SSI task. Those tasks will be processed in the server just before sending the information to the client browser. To the browser a SSI page will look exactly as a regular HTML page.
 

We will find those identifiers in SSI pages:
  • <!--# is the opening identifier.
  • "-->" is the closing identifier.
The basic structure will be like this one:
<!--#'<tag><variable set> '-->

We will focus in two options provided by SSI:

  • include tag. Allows to add the content of a file within our server to our page before transmission back to the client browser.  By using this option we may keep important information which is common to different pages in a unique file, so that when changing this file we will change all the files simultaneously (p.e.  when the heading of all pages are the same, or when we want to add a list of links in the bottom of all pages).

  • The ability to add environmental variables to our pages (which is very similar to the system used in ASP). Time related environmental variables may be display in different ways as shown in a example bellow.


Bellow you will find three easy examples you may use in your pages



Tutorial home page

2010@ Submitside.com. All rights reserved.