HTML-3.0/Server Side Includes



Embedded java scripting

java code can be included directly in your html document. The following is an example that prints out the name of your web browser, and its version information. If you do not see anything in the parenthesis, your browser is not supporting Java Scripting.
(<script>
document.write("You are using: " + navigator.appName + " " + navigator.appVersion);
</script>)

()

Including Files

You can include files into html documents. The included files are interpreted just like normal html. If no file is specified, the current file is included, possibly resulting in an infinite loop.
<!--#include file="thisfile" -->

File Modification Date

This displays the modification date of the the file in quotes. If no file is specified, the current directory is used.
<!--#flastmod virtual="thisfile" -->

If you want the modification date of the current document, you can do something like

<!--#flastmod virtual="$SCRIPT_NAME" -->

Config Options

This option changes the behavior of server-side includes.
<!--#config <option>="" -->

flastmod

This is the default form used by flastmod.
<!--#config timefmt="%A, %d-%b-%y %T %Z" -->

timefmt

This is the default unit form used by fsize.
<!--#config sizefmt="abbrev" -->

sizefmt

You can change the units used by fsize to bytes with
<!--#config sizefmt="bytes" -->

errmsg

You can change the error message dispayd when a server-side include fails.
<!--#config errmsg="You're a complete looser" -->

File Size

This displays the size of the file in quotes. If no file is specified, the current directory is used.
<!--#fsize file="thisfile" -->

Run Shell Commands

This will run the command in quotes in sh on the local system and display the output.
<!--#exec cmd="echo hi" -->

Run a CGI script

This will run the CGI script in quotes, and display any output.
<!--#exec cgi="echo_hi.cgi" -->

Set Variables

This will set variables in the html code space. These are not the same as environment variables, or hidden variables.
<!--#set var="ANSWER" value="42" -->

Echo Variables

This will echo variables, either set by the server or by the set server-side include.
<!--#echo var="ANSWER" -->

Print Environment

This will print out the entire set of environement variables.
<!--#printenv -->

If Then Else

This handles flow control. It's pretty much your standard if-then-else.
<!--#if expr="\"$ANSWER\" < \"42\"" -->
too low
>!--#elif expr="\"$ANSWER\" > \"42\"" -->
too high
>!--#elif expr="\"$ANSWER\" = \"42\"" -->
thats the answer
<!--#else -->
hmmm, you shouldn't get here
<!--#endif -->

too low too high thats the answer hmmm, you shouldn't get here

Official docs on server-side includes can be found in apache's documentation

this is the end of the document


K. Scott Rowe