Logo Your Web Hosting Solution
Line
SSI Tutorial
Introduction
Using Variables
Including Files
Execute Scripts
Validate SSI
Tutorials Index
Home Page
SSI Tutorial - Environment Variables

Variables can be used to display information about people viewing a web page, the page itself and more.

To view a full list of available environment variables, add the below lines to a web page, upload it to your hosting account and view it in your web browser.

<PRE>
<!--#printenv -->
</PRE>

1. The Web Page

With SSI, environment variables can be used to show some information about the web page being shown.

<!--#echo var="DOCUMENT_NAME" -->
<!--#echo var="LAST_MODIFIED" -->

The first line simply shows the filename of the web page. The second shows when it was last modified.

Example:

    Filename : ssi_variables.html
    Modified : Tuesday, 14-Apr-2015 12:47:45 CDT
2. Current Time And Date

You can use SSI to include the current time and date in web pages. Both local server time or GMT can be used.

<!--#echo var="DATE_LOCAL" -->
<!--#echo var="DATE_GMT" -->

Example:

    Server Time : Monday, 20-Nov-2017 03:15:41 CST
    GMT Time : Monday, 20-Nov-2017 09:15:41 GMT
3. The Visitor

SSI can be used to display the IP address of a person viewing your web pages.

<!--#echo var="REMOTE_ADDR" -->

Remote host information can be shown (if available).

<!--#echo var="REMOTE_HOST" -->

You can even display the browser version of the visitor.

<!--#echo var="HTTP_USER_AGENT" -->

Example:

    Your IP address is : 54.162.166.214
    Your remote hostname is : (none)
    Your browser : CCBot/2.0 (http://commoncrawl.org/faq/)
These are quick and easy SSI examples, many other variables can be used with Server Side Includes.

Top Of Page 
Line
Copyright© 1996 - 2017 Clockwatchers, Inc.