1. Home
  2. Hosting
  3. Glossary
  4. SSI – Dynamic Content Generation for HTML Pages

SSI – Dynamic Content Generation for HTML Pages

SSI (Server Side Includes) enables you to add dynamically generated content to an existing HTML page.

Usually HTML pages contain HTML code and content that does not change. SSI enables you to dynamically generate small pieces of the HTML page’s content.

Note: SSI cannot replace CGI programs for dynamic webpage generation such as PHP and others. Instead, SSI can be used to add small pieces of dynamically generated content to already existing HTML pages.

The web server distinguishes parts of the HTML page which need to be dynamically generated through the SSI tags embedded in the page.

E.g. on the webpage:

<!DOCTYPE html>
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
</p>The requested URL <!--#echo var="REQUEST_URI" --> was not found on this server.</p>
</body></html>

<!–#echo var=”REQUEST_URI” –> is an SSI tag that will be replaced with the URL requested by the web client.

not found

SSI tags enable different data to be displayed such as the date when the file was last modified.

This document last modified <!--#flastmod file="thisfile.shtml" -->

Or embedding the results from a CGI program:

<!--#include virtual="/file.php" -->

SSI supports setup and use of variables. For displaying the last modification of a certain file, you can use the variable $LAST_MODIFIED.

<!--#set var="modified" value="$LAST_MODIFIED" -->

Then to echo and display the content of the variable=modified you can use:

<!--#config timefmt="%D" -->
This file last modified <!--#echo var="modified" -->

#config timefmt=”%D” – sets the date format;

The web server will scan for tags only HTML files with a .shtml extension.

SSI tags are always processed before the HTML page is sent to the web browser.

Note: Upon new hosting account activation the root directory (public_html) contains a few system files used by the web server to display 401.shtml, 403.shtml, 404.shtml and 500.shtml error messages. These files will be used only if the website system does not use its own methods to process 401, 403, 404 and 500 status codes. You can edit those .shtml files through the File Manager or the Editor under the Error Pages menu in cPanel.

SSI enables you to add dynamically generated content to an existing HTML page, without having to generate the whole page via a CGI program or another dynamic technology.

Updated on 29.11.2021

Was this article helpful?

Related Articles