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" --> 

 

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
AUTH_TYPE client authorization method if any  
CONTENT_LENGTH size of input posted from client
CONTENT_TYPE MIME type of content  
DATE_GMT The current GMT (greenwich, UK) can be formatted using #config Saturday May 17 2008 
DATE_LOCAL current time/date, can be formatted using #config Saturday May 17 2008 
DOCUMENT_NAME document name that was requested
DOCUMENT_URI URL of the document /sites/webhelpinghand.com/ssi001.shtml 
LAST_MODIFIED document modified date, can be formatted using #config Wednesday October 31 2007 
PAGE_COUNT number of accesses to current document since server was brought on line Variable 'PAGE_COUNT' cannot be found
 
HTTP_REFERER URL of the document the client came from Variable 'HTTP_REFERER' cannot be found
 
REMOTE_ADDR Numeric IP address of the client 38.103.63.16 
REMOTE_HOST domain name of the client (DNS option must be active on server) 38.103.63.16 
REMOTE_USER ID of user, rarely ever found  
REQUEST_METHOD HTTP method: GET OR POST GET 
SERVER_NAME server hostname www.webhelpinghand.com 
SERVER_PORT the port used by httpd (usually 80) 80 
SERVER_PROTOCOL Which version of Httpd compliance HTTP/1.1 
SERVER_SOFTWARE The name of the server software, i.e., apache 1.2.5 Microsoft-IIS/6.0 
TOTAL_HITS total pages served by server since brought on line Variable 'TOTAL_HITS' cannot be found
 

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:

Saturday

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

 

Internet Tips Contents
404 Errors Advertising Autoresponse Awardmaster Basics Browsers Careers Chatting Disasters Domains Email Emoticons Ezines Free Stuff Fun Stuff FTP Graphics Homepages HTML Reference HTML Tutorial Interactive Legal Links Msg Boards Microsoft Money Multimedia Networks Newsgroups Newsletter Products RFC's Ringmaster Searches Security Sticky Sites Surfing TANSTAAFL Telnet Viral Webmaster Your System