Shtml
   HOME

TheInfoList



OR:

Server Side Includes (SSI) is a simple interpreted server-side scripting language used almost exclusively for the World Wide Web. It is most useful for including the contents of one or more files into a web page on a
web server A web server is computer software and underlying hardware that accepts requests via HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, commonly a web browser or web crawler, initiate ...
(see below), using its #include directive. This could commonly be a common piece of code throughout a site, such as a page header, a page footer and a navigation menu. SSI also contains control directives for conditional features and directives for calling external programs. It is supported by
Apache The Apache () are a group of culturally related Native American tribes in the Southwestern United States, which include the Chiricahua, Jicarilla, Lipan, Mescalero, MimbreƱo, Ndendahe (Bedonkohe or Mogollon and Nednhi or CarrizaleƱo an ...
,
LiteSpeed Litespeed is a U.S. bicycle manufacturer founded in 1986 in Ooltewah, Tennessee by David Lynskey. Litespeed makes titanium and carbon fiber frame road racing bicycles and mountain bikes. Titanium bicycle frames are famed for their ride qualit ...
, nginx, IIS as well as
W3C The World Wide Web Consortium (W3C) is the main international standards organization for the World Wide Web. Founded in 1994 and led by Tim Berners-Lee, the consortium is made up of member organizations that maintain full-time staff working to ...
's Jigsaw. It has its roots in NCSA HTTPd. In order for a web server to recognize an SSI-enabled HTML file and therefore carry out these instructions, either the filename should end with a special
extension Extension, extend or extended may refer to: Mathematics Logic or set theory * Axiom of extensionality * Extensible cardinal * Extension (model theory) * Extension (predicate logic), the set of tuples of values that satisfy the predicate * E ...
, by default .shtml, .stm, .shtm, or, if the server is configured to allow this, set the execution bit of the file.


Design

As a simple programming language, SSI supports only one
type Type may refer to: Science and technology Computing * Typing, producing text via a keyboard, typewriter, etc. * Data type, collection of values used for computations. * File type * TYPE (DOS command), a command to display contents of a file. * Ty ...
: text. Its control flow is rather simple, choice is supported, but loops are not natively supported and can only be done by recursion using include or using HTTP redirect. The simple design of the language makes it easier to learn and use than most server-side scripting languages, while complicated server-side processing is often done with one of the more feature-rich programming languages. SSI is Turing complete. SSI has a simple syntax: <!--#directive parameter=value parameter=value -->. Directives are placed in HTML comments so that if SSI is not enabled, users will not see the SSI directives on the page, unless they look at its source. Note that the syntax does not allow spaces between the leading "<" and the directive. Apache tutorial on SSI stipulates the format requires a space character before the "-->" that closes the element.


Examples

A web page containing a daily quotation could include the quotation by placing the following code into the file of the web page: With one change of the quote.txt file, all pages that include the file will display the latest daily quotation. The inclusion is not limited to files, and may also be the text output from a program, or the value of a system variable such as the current time.


Directives


Common

The following are SSI directives from the times of NCSA HTTPd (the 1990s). Some implementations do not support all of them.


Control directives

Control directives are later added to SSI. They include the ubiquitous if-elif-else-endif flow control and variable writing as well as more exotic features like loops only found in some implementations.


See also

* ESI (Edge Side Includes)


Notes


References


External links

* Language reference from implementations: ** Apache
Apache mod_include Reference
Calls directives "elements". ** Nginx

Calls directives "commands". ** NCSA HTTPd
Original NCSA HTTPd SSI Reference
Calls directives "commands". ** W3C Jigsaw

Calls directives "elements". Highly expanded with servlets, JDBC,
HTTP cookie HTTP cookies (also called web cookies, Internet cookies, browser cookies, or simply cookies) are small blocks of data created by a web server while a user is browsing a website and placed on the user's computer or other device by the user's w ...
, and loops. * Tutorials:
Apache SSI Tutorial
*

*
SSI-Developer, Apache Server Side Includes
{{Web interfaces Scripting languages Web 1.0 Web technology