[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]
[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]
Empty Space

Include Files

Include files are these neat things implemented in newer versions of Apache. They allow a file to be included in another file. This allows the creation of a standard header for a series of pages without having to actually put the header information in each page of the series. Then if you ever want to change the header you only have to edit the one file.

The way this works is that the page code has an sgml line something like <!--#include file="header" -->. When Apache gets a request for a web page it scans the requested document for sgml commands embedded in comments. in this case an instruction to include the file named "head" in the same directory as the requested document. The file is then included at that point, replacing the entire comment and sgml command. This means that the web browser which requested the document doesn't even know what is going on. All of the capability is in the web server.

All of the pages on this site use a standard javascript include file, a standard header and a standard footer. In addition all of the buttons which highlight are also done using an include file. By intelligent chunking of the documents into include files, site maintenance work load is substantially reduced. Of course, the web server being used must support Server Side Includes. Apache isn't always compiled with this option -- check with the server administrator to find out. Because the extra parsing requires work on the servers part it increases the server load. All of this is a give and take situation.

The most useful information that I have found about Server Side Includes is from Apache's documentation on the subject.

Improper use of includes can break character encoding, e.g., &nbsp;, may be encoded and sent to the client browser as &amp;nbsp; -- which of course prevents non-breaking space (and other) encodings. You can control the encoding of an "echo" directive by specifying an 'encoding="type"' which is effective from when it is given until the next encoding statement is encountered. For example:

<!--#set var="Test" value="With&nbsp;Space" -->

<!--#echo encoding="none" var="Test" -->

By setting include configurations the appearance of a page can be further "dressed up." The default error message is usually something along the lines of "An error was encountered processing this directive." While true, it isn't very pretty and can indicate that there is a fault in your document -- which isn't always the case. The error message to be displayed if an error is encountered is the last specified error message. If you are providing listings of files which may or may not be present at any given time the following is more reflective of the actual situation:

<!--#config errmsg="file unavailable" -->

The filesize can be either reported as a number of bytes or using an abbreviation appropriate to its size (e.g., mb or kb). Of greater utility is the ability to set the date format. This follows the strftime() of unix. Type 'man strftime' for a complete listing of codes. To use the default format localized format do:

<!--#config timefmt="%c" -->

To get more use out of SSI you will have to know what environment variables are normally available. Although the Apache documentation lists those added for SSI, you also have full access to the normal CGI environment variables.


SCRIPT_URL=/~drakki/Includes/index.html
SCRIPT_URI=http://www.rollanet.org/~drakki/Includes/index.html
URL_COUNT=1
URL_COUNT_RESET=counters were removed.
HTTP_X_CC_ID=ccc01-01
HTTP_HOST=www.rollanet.org
HTTP_USER_AGENT=CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
HTTP_ACCEPT=text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
HTTP_ACCEPT_ENCODING=gzip
HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_CONNECTION=close
HTTP_CACHE_CONTROL=no-cache
HTTP_PRAGMA=no-cache
PATH=/usr/bin:/bin
SERVER_SIGNATURE=<address>Apache/2.2.8 (Fedora) Server at <a href="mailto:helpdesk@rollanet.org">www.rollanet.org</a> Port 80</address>

SERVER_SOFTWARE=Apache/2.2.8 (Fedora)
SERVER_NAME=www.rollanet.org
SERVER_ADDR=74.208.105.248
SERVER_PORT=80
REMOTE_ADDR=38.107.191.94
DOCUMENT_ROOT=/local/web/public_html
SERVER_ADMIN=helpdesk@rollanet.org
SCRIPT_FILENAME=/users/drakki/public_html/Includes/index.html
REMOTE_PORT=48742
GATEWAY_INTERFACE=CGI/1.1
SERVER_PROTOCOL=HTTP/1.1
REQUEST_METHOD=GET
QUERY_STRING=
REQUEST_URI=/~drakki/Includes/index.html
SCRIPT_NAME=/~drakki/Includes/index.html
DATE_LOCAL=Saturday, 20-Mar-2010 09:07:34 CDT
DATE_GMT=Saturday, 20-Mar-2010 14:07:34 GMT
LAST_MODIFIED=Monday, 08-Jan-2001 12:45:13 CST
DOCUMENT_URI=/~drakki/Includes/index.html
USER_NAME=virtuser
DOCUMENT_NAME=index.html
area=TheNexus
number=5
name=Env Var
link=http://hoohoo.ncsa.uiuc.edu/cgi/env.html
text=CGI and SSI environment variables
[an error occurred while processing this directive]