jump to another section | Index |
Server-side includes allow you to have a common header or footer for all pages, and change it by editing one file. The web server builds the page from the fragments each time it is requested. There are also several other functions of server-parsed html.
To make your html file be treated as shtml, rename it to filename.shtml. You can now put commands into your html to perform specific functions.
<!--#include virtual="footer.html" -->
This will insert the contents of footer.html in place of the command.
<!--#include virtual="/cgi-bin/textcounter.cgi" -->
This inserts the output of the CGI script where the command is.
Do not use the "exec cgi" command to run cgi, it is outdated and discontinued.
<!--#config timefmt="%B %e, %Y" --><!--#echo var="DATE_LOCAL" -->
These two commands work together. The first configures the time format, and the second actually displays the date. Many time configuration options are available, see the Solaris strftime manual page for the full listing (when logged in with telnet or ssh, type "man strftime").
There is still much more you can do. Please see the Apache documentation on includes for a full list of commands.
One example to detect the browser version:
<!--#if expr="$HTTP_USER_AGENT = /MSIE/" --> you are using microsoft internet explorer <!--#if expr="$HTTP_USER_AGENT = '/MSIE 3/'" --> version 3 <!--#elif expr="$HTTP_USER_AGENT = '/MSIE 4/'" --> version 4 <!--#elif expr="$HTTP_USER_AGENT = '/MSIE 5/'" --> version 5 <!--#else --> version (unknown) <!--#endif --> <!--#elif expr="$HTTP_USER_AGENT = /Mozilla/ && $HTTP_USER_AGENT != /compatible/" --> you are using netscape navigator <!--#if expr="$HTTP_USER_AGENT = /Mozilla\/3/" --> version 3 <!--#elif expr="$HTTP_USER_AGENT = /Mozilla\/4/" --> version 4 <!--#elif expr="$HTTP_USER_AGENT = /Mozilla\/5/" --> version 5 <!--#else --> version (unknown) <!--#endif --> <!--#else --> you are not using microsoft internet explorer or netscape. <!--#endif -->