Server-side includes are essentially processing directives embedded in an HTML file which are read by the server software prior to sending a requested document and substituted with information described in the directive. This way a document fragment may be included into a larger file (e.g. in order to easily control a repeated section of a document set, like a navigation bar), an environment variable may be echoed, a page counter may be displayed.
Yawn uses the format of includes used in the NCSA httpd and Apache servers:
<!--#command tag="value" -->
As you can see, the directive is embedded in an overloaded HTML comment. The hash sign (#) signals that the comment should be interpreted by the server.
Here's a test page using all of the includes shown below - every information put in bold type was dynamically linked to the document before serving it.
Note: for the mechanism to work, the file in question must be recognized by server as a parsed (interpreted) one. This is done by saving the file with an .xtm extension. The configuration file contains a definition of a server-internal MIME type text/x-server-parsed-html which binds the type to the above extension. Below you'll find examples of the use of includes. Illustrations of SSI syntax are followed by their actual use.
This paragraph is included into the main file by means of the following directive:
You can have a look at the inluded file here. For the difference between the tags "virtual" and "file", see here. You can also include parsed files containing includes themselves, to the maximum of four levels.
This is the set of variables that can be displayed using the server-side include mechanism of Yawn:
<!--#echo var="SERVER_NAME" -->
This include echoes the name of the server, as defined in the configuration file, for example, the name of this server is www.cpu.lublin.pl.
<!--#echo var="SERVER_PORT" -->
This include echoes the port on which the server is running, taken from the configuration file;for example, this HTTP server uses port number 80.
<!--#echo var="SERVER_ADMIN" -->
This include echoes the address of the server's administrator, taken at start-time from the configuartion file. You can use it for example when writing custom error messages; for example, the address of this site administrator is webadmin@www.cpu.lublin.pl.
<!--#echo var="DATE_LOCAL" -->
This include echoes the current local date and time, for example, today is Wed, 31 Mar 2004 11:12:38. You can modify the outlook of its results by using the appropriate configuration include prior to its use.
<!--#echo var="DATE_GMT" -->
This include echoes the current date and time in the GMT format, for example, today is Wed, 31 Mar 2004 09:12:38 Note that the effect of this include depends upon the setting of the variable TIMEZONE in your system. See NetWare manuals for further details. You can modify the outlook of its results by using the appropriate configuration include prior to its use.
<!--#echo var="REMOTE_ADDR" -->
This include echoes the IP address of the user requesting a document, for example, your IP address is 212.182.63.154.
<!--#echo var="HTTP_REFERER" -->
This include echoes the contents of the Referer HTTP header sent to the server by most browsers. It is the location of the document from which the request comes (the page or script that contains a link to the requested document); for example, before you requested this page, you were viewing the URL http://www.cpu.lublin.pl:80/yawn/menu.htm.
<!--#echo var="DOCUMENT_URI" -->
This include echoes the URI of the requested document (its location relative to DocumentRoot, in the URI format), for example, the URI of this document as requested from the server after connection was established is /yawn/ssi.xtm.
<!--#echo var="DOCUMENT_NAME" -->
This include echoes the location of the requested document after translating from the URI format into system path notation, for example, the NetWare path of this document is sys:htdocs/yawn/ssi.xtm.
<!--#echo var="LAST_MODIFIED" -->
This include echoes the date and time of the last modification of the current file, for example, this file was last modified Mon, 03 Jun 1996 15:00:42. You can modify the outlook of its results by using the appropriate configuration include prior to its use.
<!--#echo var="HTTP_USER_AGENT" -->
This include echoes the UserAgent (browser/robot type) header sent to the server by the client software. Using this you can determine what browser is requesting your page; for example, you're using the Wget/1.5.3 browser.
<!--#echo var="SERVER_SOFTWARE" -->
This is taken the other end of the transaction: the include echoes the Server HTTP header, a string describing the server software you are using that gets sent to the client. Yawn sends its name/version and a comment specifying its expiration date (for unregistered copies) as well as the NLM file checksum (just in case), so that the browser gets Yawn 1.05.
<!--#echo var="SERVER_PROTOCOL" -->
This include echoes the version of HTTP protocol used by the server software as output to the client software; for example, Yawn uses HTTP/1.0.
<!--#echo var="REQUEST_METHOD" -->
This include echoes the HTTP method used by the browser to access the resource (html document, script), for example, your browser used the GET method to access this file.
<!--#fsize virtual="/yawn/index.htm" -->
This include gives the file size of a given file; for example, the size of the main page of this manual is 340 bytes. For the difference between "virtual" and "file", see here. You can configure the outlook of the data.
<!--#flastmod virtual="/yawn/index.htm" -->
This include gives the last modification date of a given file; for example, the main page of this manual was last modified Sun, 23 Mar 1997 12:27:06. For the difference between "virtual" and "file", see here. You can configure the outlook of the data.
<!--#echo var="server_total_connections" -->
This include echoes the total number of HTTP connections served by the software within its uptime period; for example, this server has been contacted 4292 times since it was last started.
<!--#echo var="server_up_time" -->
This include echoes the time of uninterrupted work of the httpd software. For example, this server has been working without interruption for 22 Days 16 Hours 36 Minutes 25 Seconds.You can configure the outlook of the data.
<!--#pagecnt -->
This exceptionally short include lets you display the hit count of the current page; for example, this page has been retrieved 5140 times. More about it on the counters page of the overview.
<!--#counter virtual="page_url" -->
This include allows you to echo the hit count for any file on your system (so that you can show on a page hit count summary for a number of files). For example, the main manual page has been accessed 29728 times. For the difference between "viertual" and "file", see here. More info on the counters page of the overview.
Includes starting with NW_ use NetWare-specific variables describing in detail the configuration of your NetWare server. Their meaning is fairly self-explanatory. For details, check your NetWare documentation.
<!--#echo var="NW_SERVER_SOFTWARE" -->
Current value:
Novell NetWare 4.11
<!--#echo var="NW_COMPANY_NAME" -->
Current value:
Novell
<!--#echo var="NW_REVISION" -->
Current value:
NetWare 4.11
<!--#echo var="NW_REVISION_DATE" -->
Current value:
August 22, 1996
<!--#echo var="NW_COPYRIGHT_NOTICE" -->
Current value:
(C) Copyright 1983-1996 Novell Inc.
All Rights Reserved.
<!--#echo var="NW_SERVER_NAME" -->
Current value:
HADES
<!--#echo var="NW_SERVER_UP_TIME" -->
Current value (configurable):
22 Days 16 Hours 37 Minutes 41 Seconds
<!--#echo var="NW_NETWORK_SERIAL_NUMBER" -->
Current value:
73026735
<!--#echo var="NW_APPLICATION_NUMBER" -->
Current value:
0
<!--#echo var="NW_NETWARE_VERSION" -->
Current value:
4
<!--#echo var="NW_NETWARE_SUB_VERSION" -->
Current value:
11
<!--#echo var="NW_MAX_CONNECTIONS_SUPPORTED" -->
Current value:
39
<!--#echo var="NW_CONNECTIONS_IN_USE" -->
Current value:
0
<!--#echo var="NW_MAX_VOLUMES_SUPPORTED" -->
Current value:
64
<!--#echo var="NW_REVISION_LEVEL" -->
Current value:
0
<!--#echo var="NW_SFT_LEVEL" -->
Current value:
2
<!--#echo var="NW_TTS_LEVEL" -->
Current value:
1
<!--#echo var="NW_PEAK_CONNECTIONS_USED" -->
Current value:
1
<!--#echo var="NW_ACCOUNTING_VERSION" -->
Current value:
1
<!--#echo var="NW_VAP_VERSION" -->
Current value:
1
<!--#echo var="NW_QUEING_VERSION" -->
Current value:
1
<!--#echo var="NW_PRINT_SERVER_VERSION" -->
Current value:
0
<!--#echo var="NW_VIRTUAL_CONSOLE_VERSION" -->
Current value:
1
<!--#echo var="NW_SECURITY_RESTRICTION_LEVEL" -->
Current value:
1
<!--#echo var="NW_INTERNET_BRIDGE_SUPPORT" -->
Current value:
1
<!--#echo var="NW_CLIB_MAJOR_VERSION" -->
Current value:
4
<!--#echo var="NW_CLIB_MINOR_VERSION" -->
Current value:
11
<!--#echo var="NW_CLIB_REVISION" -->
Current value:
r
To configure the output of some includes, you can use the configuration directive:
<!--#config ... -->
There are three tags that you can use with the directive:
<!--#config sizefmt="bytes | abbrev" -->
This configuration directive is used with the fsize include (i.e. it should precede fsize in an .xtm file). "Bytes" causes a file size to be represented as the exact number od bytes, while "abbrev" shows each started kilobyte/megabyte of the size.
<!--#config sizefmt="bytes" -->
Size of this file: 19257
<!--#config sizefmt="abbrev" -->
Size of this file: 18 KB
<!--#config intervalfmt="%D %H %M %S" -->
This is used with the directives that echo server_up_time and NW_SERVER_UP_TIME. The abbreviations given above stand for - respectively - days, hours, minutes, and seconds. In the configuration string you can embedd any text you want to apppear as the output of the directive and the abbreviations in any order.
<!--#config intervalfmt="%D days, %H hrs, %M mins, %S secs" -->
The uptime of this httpd server is:
22 days, 16 hrs, 36 mins, 25 secs
<!--#config timefmt="..." -->
This directive can be used with all includes which echo time data (LAST_MODIFIED, flastmod, DATE_LOCAL, DATE_GMT). Like intervalfmt, it allows you to mix text and embedded codes (abbreviations) to specify the exact format of the date/time that will be echoed. The codes used here are exactly the same as used by the C system function strftime, which are:
%S | 2-digit second |
---|---|
%M | 2-digit minute |
%I | 2-digit hour |
%H | 2-digit hour |
%p | AM or PM |
%w | Weekday: 0 = Sunday |
%a | Abbreviated weekday name |
%A | Full weekday name |
%d | 2-digit day of month |
%j | 3-digit day of year |
%U | 2-digit week number: Sunday = 1st day of week |
%W | 2-digit week number: Monday = 1st day of week |
%m | 2-digit month, decimal |
%b | Abbrev. month name |
%B | Full month name |
%y | 2-digit year, no century |
%Y | Year with century |
%x | Date |
%X | Time |
%c | Date and time |
%Z | Time zone name, or no chars if no time zone |
%% | the character % |
<!--#config timefmt="%A, %B %d, %H:%M %p (%Z)" -->
This file was last modified on:
Monday, June 03, 15:00 PM (MEST)
Some of the directives (include, fsize, flastmod, counter) allow you to specify the name of the file the output data refer to. This can be done by using one of the following tags:
virtual - the value of the tag is an URL of the file in question, relative to the DocumentRoot directive from the configuration file httpd.cfg. An example could be "/yawn/index.htm" or "/yawn/examples/errors/404.htm".
file - this is a system path to the file relative to the location of the current document. Example: "examples/errors/404.htm".
[Home -
Overview -
Downloading -
Installation -
Configuration -
Implementation notes -
License -
Registering -
Contacts]