Inserting the value of an environment variable
The SSI echo command tells the Web server to insert the value of an environment variable at the location of the command in the document’s source code, before sending it to a Web browser. An environment variable is a piece of information, provided by the server, about the current document or some operating aspect of the server itself. You can use an echo command in a document to, for example, have the server insert the local time or the document’s last modification date in a paragraph somewhere in the document. The server determines the value of the specified environment variable at the time it encounters the echo command.
To insert an echo command
- Place the insertion point at the location in the current document where you want the environment variable’s value to be inserted by the Web server.
- On the Custom toolbar, click SSI, and then click Echo. (If the the SSI command is not visible in the Custom toolbar, add it to the Custom toolbar by selecting Insert from the Categories list and then SSI from the Commands list.)
- Click the Variable box, type or select the desired environment variable, and then click OK.
If the display of special tag marksTo toggle the display of special tag marks, click Show/Hide Special Tag Marks on the Standard Toolbar. is enabled, an “SSI” box () will appear at the location of the echo command.
The environment variables that are selectable in the Variable box are described below.
You can type the name of any environment variable into the Variable box, even if it is not available in the drop-down menu.
General-purpose variables
These variables have general usefulness.
DATE_GMT |
The GMT (Greenwich Mean Time) date/time at the moment the Web server executes the echo command. The format is controlled by a config timefmt command. |
DATE_LOCAL |
The local date/time at the moment the Web server executes the echo command. The format is controlled by a config timefmt command. |
DOCUMENT_NAME |
The file name of the current document. |
DOCUMENT_URI |
The virtual path of the current document. |
HTTP_ACCEPT |
The MIME types accepted by the browser. |
HTTP_REFERRER |
The URL of the page from which the user came to the current document (usually by clicking a hyperlink), if any. |
HTTP_USER_AGENT |
The name and version of the browser. |
LAST_MODIFIED |
The local date/time when the current document was last modified. The format is controlled by a config timefmt command. |
REMOTE_ADDR |
The IP address of the user’s computer. |
REMOTE_HOST |
The hostname of the user’s computer. |
REMOTE_USER |
The username of the user (only available if the user logged in to access the current document). |
SERVER_NAME |
The Web server’s hostname, DNS alias, or IP address. |
SERVER_PORT |
The port number of the Web server (usually 80) for the current communication. |
SERVER_PROTOCOL |
The name and version number of the Internet protocol (such as HTTP) for the current communication. |
SERVER_SOFTWARE |
The name and version of the Web server software. |
CGI-specific variables
These variables are only meaningful when the document being served was generated by a CGI script.
CONTENT_LENGTH |
The length of any content attached to the query by the browser. |
CONTENT_TYPE |
The type of any content attached to the query by the browser. |
GATEWAY_INTERFACE |
The version of CGI in use by the server. |
PATH_INFO |
The extra path information, if any, appended to the script’s path name by the browser. |
PATH_TRANSLATED |
The same as PATH_INFO, but translated from a virtual path to a physical path. |
QUERY_STRING |
The query string, if any, appended to the script’s URL by the browser. |
QUERY_STRING_UNESCAPED |
The unescaped version of QUERY_STRING. |
REQUEST_METHOD |
The method by which the browser request was made (such as GET or POST). |
SCRIPT_NAME |
The virtual path of the current script. |
Related topics
Controlling the date-time format for an echo command