Server Side Includes.

Server Side Include (SSI) are directives that are placed in the HTML pages. These directives are evaluated on the server when the pages are served. When the existing pages are served, they help you add the dynamically created content to it. It eliminates the need of CGI or other dynamic technology.

The use of this technology is depended upon the nature of the pages. Some pages are more static and some needs to be recalculated every time the page is served. Adding small pages of information is done efficiently by SSI. If the pages need more dynamic generation, then some other technology can be used.

More specifically if we say this is a server side scripting language which is used exclusively for the web. Its primary use is including the contents of one file into other while the latter is been served by the web server. Mostly the SSI is preferred for the  simple automation task. If there needs some more complex server side scripting then other language are used for eg. Perl, PHP, ASP, ASP.NET, JSP, Java, CFML, Python, and Ruby.

If we look at the Syntax it is quite simple and the directives are placed in HTML comments so that if SSI is not enables then the users will not see the SSI Directives on the page. The users will have to look at the source of the page if they are eager to know what is used.

Syntax : <!--#directive parameter=value parameter=value -->


server-side-includes

For SSI to Work you need a file in text format called .htaccess in the directory where you put the HTML file. The .htaccess file which is present should contain the three important command lines:

Options Indexes FollowSymLinks Includes

AddType application/x-httpd-cgi .cgi

AddType text/x-server-parsed-html .html

Listed below are some of the basic SSI Directives :

Echo : This directive is useful in inserting certain data in variable form in the HTMLPage.

Include: The most used directive which allows to include the content of the one document to other.

FSize: this directive is used to display the size of the specified document.

Flastmod : This Directive is used for displaying the date when the specified was last modified

Exec: Useful to execute the External executable file.

Config: This directive is useful for setting up certain HTML output options.

ODBC: One of the most use full directives which is useful in quering and updating the ODBC Database.

Email : This directive takes care of the sending and receiving email whenever HTML page is accessed or HTML form is submitted.

As there is a technology at Server side there exists a technology at the client side called Client Side Includes. CSI are the HTML includes achieved on the client Side through use of iFrames, JavaScript. These methods have a big shortcomings than the server side includes : they rely on the client support from the respective technologies.

Scroll to Top