CU Home
Columbia University Information Technology
SSI Quick Reference

Web Design > SSI Quick Reference

Following the code, you can see it in action on this page. If the SSI you are using displays a date, you might want to specify these variables.

Date of current file's last modification
<!--#echo var="last_modified" --> Tuesday, 16-May-2006 11:57:37 EDT

The size of a file 
<!--#fsize virtual="/cu/lweb/index.html" -->  17K Date of a given file's last modification
<!--#flastmod virtual="/cu/lweb/index.html" --> Wednesday, 25-Nov-2009 09:22:57 EST

Current date in the local time zone
<!--#echo var="date_local" --> Sunday, 29-Nov-2009 01:51:15 EST

The browser the client is using
<!--#echo var="http_user_agent"-->
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

The current date in Greenwich Mean Time
<!--#echo var="date_gmt"--> Sunday, 29-Nov-2009 06:51:15 GMT

The filename (excluding directories) of the document requested by the user.
<!--#echo var="document_name"--> ssi2.html

The (%-decoded) URL path of the document requested by the user. Note that in the case of nested include files, this is not then the URL for the current document.
<!--#echo var="document_uri"--> /acis/webdev/ssi2.html

(The following are part of the Apache Standard CGI Environment Variables)

The revision of the Common Gateway Interface that the server uses
<!--#echo var="gateway_interface"--> CGI/1.1 The server's hostname or IP address
<!--#echo var="server_name"--> www.columbia.edu The name and version of the server software that is answering the client request
<!--#echo var="server_software"--> Apache/2.2.13

The name and revision of the information protocol the request came with
<!--#echo var="server_protocol"--> HTTP/1.1

The port number of the host on which the server is running
<!--#echo var="server_port"--> 80

The method with which the request was issued: GET or POST
<!--#echo var="request_method"--> GET

Extra path information
<!--#echo var="path_info"--> (none)

The translated version of PATH_INFO
<!--#echo var="path_translated"--> (none)

The directory from which the web documents are served
<!--#echo var="document_root"--> /etc/httpd/data

The remote hostname of the user making the request
<!--#echo var="remote_host"--> (none)

The remote IP address of the user making the request
<!--#echo var="remote_addr"--> 38.107.191.86

The authentication method used to validate a user
<!--#echo var="auth_type"--> 38.107.191.86

The authenticated name of the user
<!--#echo var="remote_user"--> (none)

The email address of the user making the request (not always available)
<!--#echo var="http_from"--> (none)

A list of MIME types that the client can accept
<!--#echo var="http_accept"--> 
text/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

The browser the client is using to issue the request
<!--#echo var="http_user_agent"-->
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

The URL of the document that the client was at before accessing current file (not always available)
<!--#echo var="http_referer"-->
(none)

Dates

Some of the ssi's display a date, for example, a file's last modification, the current date in the local time zone, etc. You can configure how the date is displayed and which elements of the date are displayed by using
<!--#config timefmt=" " --> and the following variables:

Full

Abbreviated

%A Full weekday name %a Abbreviated weekday name
%B Full month name %b Abbreviated month name
%Y Full year %y Abbreviated year
%D Date as mm/dd/yy %d Day of the month
%H Hour as 1 - 23 %I Hour as 1 - 12
%M Minutes 0 -60 %m Month of the year 01 - 12
%R Time as %H: %M %r  Time as %I: %M: %S: %p
%p a.m. or p.m. %T Time as %H: %M: %S
%S Seconds as 0 - 60 %Z Time zone name

For example

<!--#config timefmt="%d %B %Y" -->
<!--#echo var="DATE_LOCAL" -->

will produce

29 November 2009


« Back to SSI Introduction Continue to SSI Flow Control »