SSI (Server Side Includes)
Server Side Includes (SSI) is a simple to use server-side scripting language, whose primary use is including the contents of one file into another one dynamically or executing of CGI scripts.
A couple of important guidelines you need to follow:
1) SSI commands always begin with <!--# and end with --> just like:
Some examples of SSI:
1) If you want to insert a file into another one, you can use the command include virtual. The URL to the page you want to insert must be relative to the current web page rather than a full URL. For example:
<!--#include virtual="file.txt"-->This command includes the contents of file.txt in your file. file.txt and the SSI file must reside in the same folder - notice how this SSI instruction uses a *relative* URL instead of a FULL URL? This is very important to keep in mind when using SSI. And if your file.txt is in a subfolder named my_ssi, you have to add it following way:
2) If you want to execute a CGI script (in this case it is a Perl script) and include its output to your webpage, use the following code:
3) Printing the size of a file named file.html residing in your subdirectory directory is very easy:
4) <!--#flastmod file="directory/file.html"-->prints the last modification date of the specified file.
You can easily define and use variables in your SSI scripts. For example, the following command defines the variable "PI" and assigns a value of "3,14159265" to it:
In addition to the variables in the standard CGI environment, these are available for the echo command, for if and elif, and to any program invoked by the document.
DATE_GMT - The current date in Greenwich Mean Time
7) Flow Control Elements
The basic flow control elements are:
The endif element ends the if element and is required.