| Server
Side Includes
Server Side Include (SSI) commands are executed by the server as it parses your HTML file. Server side includes can be used to include the value of various server environment variables within your HTML such as the local date and time. One might use a server side include to add a signature file to an HTML file or company logo. HTML files containing SSI must be named with an .shtml extension. Please note that HTML files containing SSI may take longer to load. SSI commands are easy to add to your HTML, but you must follow the syntax exactly:
Be sure to leave a space after the ending quotation mark (") of the argument variable. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Using
the echo Command
The echo tag provides for inserting the data of certain variables into an HTML page. The only variable under the echo tag is 'var'. The data in an echo token is translated into a string that depends on the value in the variable and that string is inserted into the HTML page at the location of the echo token in the HTML page. The values allowed as variable data are available form two sources: Form fields and environment variables. Form Fields are those datum which are available when a POST operation is performed on a SSI enabled HTML document from an HTML form. Each form field may be referenced by name. Example: Suppose one has an HTML form with several fields defined, one of which is named 'First Name'. When an HTTP client POSTs the form to an SSI enabled HTML document with an echo token: <--#echo var="First Name" -->, the HTML document will then have the contents of the supplied 'First Name' field inserted upon transmission to the client. The echo command can be used to display the content of several server/client side environment variables listed in the table below.
Example: This code:
See Using the config Command to configure the output. Using the config Command The config command can be used to configure the standard output of various environment variables. In the following example, two SSI commands are used in conjunction to produce an alternative date and time format:
The most common use for this command is to change the date printed when using the flastmod SSI command. The flastmod SSI command prints the last modified date of a file. If you use your SSI commands to do more complex tasks, however, like executing a CGI or system command, you might find it useful to return a polite error message. Perhaps the requested CGI program is only available to registered users. You could change the error message to return a polite I'm sorry, this function is only available to registered users instead of the rather cryptic default error message of ["an error occurred while processing this directive"]. The
syntax of the
The second valid command_argument affects mainly the fsize command. It changes whether the size returned by the fsize will be returned in bytes or in a rounded-up kilobyte format. The command_argument is sizefmt, which accepts either the argument values of bytes or abbrev.
Finally, the timefmt command argument is quite useful. You can use this inside regular text to return a date or time formatted to your preference. Whether you want only the day of the week, the current hour, or a full GMT date stamp, timefmt enables you to format the current date to fit all your needs. Table 3.3 shows all the possible variations for the date format. It's amazing how many varieties of time are available to you. The format for configuring the time follows:
This code:
Using the flastmod Command The flastmod command can be used to show the Date and time a document was last modified. Specify the path including the filename that you wish to display the last modified Date and time. Why use this instead
of <!--#echo var="Last_Modified" --> ? This code (in pageone.html):
See Using the config Command to configure the output. Using the fsize Command The fsize command might be helpful if you were to include a thumbnail image and want to display the actual file size of the original image. e.g.
The include command can be used to include a signature file or company logo within an HTML document. The added document or image will appear as if it were part of the original document. e.g.
If the file to be included is in a different directory than the SHTML document. use the virtual command argument instead. In the following example, the SHTML document resides in a subdirectory but includes a file within account root directory: eg. The exec command can be used to execute a CGI script when the web page is loading. In the following example, the script test.cgi within the relative path /cgi-exec is executed. eg.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||