Using environment variables Web Designing

The information placed in the document was prepared ahead of time and saved in a file on the server for future use. Another type of information that can be used by an SSI element is environment variables. These are bits of information that the operating system (or the HTTP server) always keeps track of and makes available for use by CGI programs and SSI. The current date and time, the modification times of local files, and the user's browser version are all examples of environment variables. To use one in an SSI, call it by its specific variable name (DATE_LOCAL, LAST_MODIFIED, and HTTP_USER_AGENT, respectively, for the previous examples) in the command.

Example: Printing the Date and Time
Let's look at a very simple example of how environment variables work. In the following example, we'll display the current date and time on the web page using the echo element (which prints a specified variable to the screen) and the DATE_LOCAL variable. If I put the following SSI command in my HTML source:

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

the server prints the following in its place:

Thursday, 28-Apr-01 16:39:24 EST

TIP
If the date and time format looks a little dry to you, you can change it using the config element and SSI time formats


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Web Designing Topics