Online Manual

SSI -2-

Displaying Information Using ECHO

You can use the ECHO directive to display specific information on your web pages. This is very simple and extremely efficient. Many JavaScript scripts contain line after line of code to do what can be done in SSI in one trivial statement.

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

Which becomes:

ssi2.htm

All of the ECHO directives which may be displayed are shown in the table below.

Server Environment Variables Which Can Be Displayed Via ECHO

Directive Description Real Example
DATE_GMT The current GMT (greenwich, UK) can be formatted using #config Friday, 09-May-2025 19:48:04 GMT 
DATE_LOCAL current time/date, can be formatted using #config Friday, 09-May-2025 15:48:04 EDT 
DOCUMENT_NAME document name that was requested ssi2.htm 
DOCUMENT_URI URL of the document /help/man/ssi2.htm 
LAST_MODIFIED document modified date, can be formatted using #config Tuesday, 31-Dec-2024 17:47:39 EST 
HTTP_REFERER URL of the document the client came from  
REMOTE_ADDR Numeric IP address of the client 3.149.249.124 
REMOTE_HOST domain name of the client (DNS option must be active on server) 3.149.249.124 
REQUEST_METHOD HTTP method: GET OR POST GET 
SERVER_NAME server hostname spunkyworld.com 
SERVER_PORT the port used by httpd (usually 80) 443 
SERVER_PROTOCOL Which version of Httpd compliance HTTP/1.1 
SERVER_SOFTWARE The name of the server software LiteSpeed 

The way that the date and time are displayed can be precisely controlled using the "timefmt" feature of the "config" directive. All you need to do is include the "timefmt" within the directive, as shown below.

<!--#config timefmt="%A %D"><!--#echo var="DATE_LOCAL" -->

which displays as:

Friday 05/09/25

You can use any of the format codes from the table below in this manner.

Date Format Codes

Code Description
%a abbreviated weekday name
%A full weekday name
%b abbreviated month name
%B full month name
%c locale's appropriate date and time
%C default date and time format
%d day of month - 01 to 31
%D date as %m/%d/%y
%e day of month - 1 to 31
%h abbreviated month name (alias for %b)
%H hour - 00 to 23
%I hour - 01 to 12
%j day of year - 001 to 366
%m month of year - 01 to 12
%M minute - 00 to 59
%n insert a newline character
%p string containing AM or PM
%r time as %I:%M:%S %p
%R time as %H:%M
%S second - 00 to 61
%t insert a tab character
%T time as %H:%M:%S
%U week number of year - 00 to 53
%w day of week - Sunday=0
%W week number of year - 00 to 53
%x Country-specific date format
%X Country-specific time format
%y 2 digit year - YY
%Y 4 digit year - YYYY
%Z timezone name

Next Page -> SSI - Include Directive

 

Return To Menu

- Last modified on 3/16/2003 -


Home / Hosting / Domain Lookup / Support / Email Contact

© 1998-2025 Spunkyworld Internet Services - All rights reserved