[Home] [About The World] [Kiosk Web Hosting] [Customer Help]
[Memo] [Login] [WebMail Login]


Source code of SSI examples


This is the actual source code of our example SSI page.


<H3>Dates and Times</H3>


<P>
  Some typical examples of "config timefmt":<BR>
  Standard short date:<BR>
  <!--#config timefmt="%x" -->
  This page was last updated on <!--#echo var="LAST_MODIFIED" -->.<BR>
  A longer custom date:<BR>
  <!--#config timefmt="%A, %B %d, %Y" -->
  This page was last updated on <!--#echo var="LAST_MODIFIED" -->.<BR>
  And now with the time too:<BR>
  <!--#config timefmt="%X %x" -->
  This page was last updated on  <!--#echo var="LAST_MODIFIED" --><BR>
  The current local date: <!--#echo var="DATE_LOCAL" --><BR>
  The current GMT date: <!--#echo var="DATE_GMT" -->
</P>

<P>
  <!--#config timefmt="a=%a, A=%A, b=%b, B=%B, c=%c, d=%d, m=%m, U=%U, W=%W, w=%w, x=%x, y=%y, Y=%Y" -->
  Some of the parameters you can use in "config timefmt":<BR>
  The local date: <!--#echo var="DATE_LOCAL" --><BR>
  <!--#config timefmt="H=%H, I=%I, j=%j, M=%M, p=%p, S=%S, X=%X, Z=%Z" -->
  Some more "config timefmt" parameters:<BR>
  The local date: <!--#echo var="DATE_LOCAL" --><BR>
  See "man strftime" for explanations.
</P>

<H3>"echo"</H3>

<P>
  <!--#config timefmt="%X %x" -->
  Some variables you can display with "echo":<BR>
  DOCUMENT_NAME = <!--#echo var="DOCUMENT_NAME" -->.<BR>
  DOCUMENT_URI = <!--#echo var="DOCUMENT_URI" -->.  (NCSA says "URI", everyone else says "URL".)<BR>
  QUERY_STRING_UNESCAPED = <!--#echo var="QUERY_STRING_UNESCAPED" -->.<BR>
  DATE_LOCAL = <!--#echo var="DATE_LOCAL" -->.<BR>
  DATE_GMT = <!--#echo var="DATE_GMT" -->.<BR>
  LAST_MODIFIED = <!--#echo var="LAST_MODIFIED" -->.<BR>
  (The LAST_MODIFIED variable is probably the most useful one here, as
  it lets your page automatically say when it was last updated!)
</P>

<H3>"include"</H3>

<P>
  "include" directives allow you to embed text or fragments of HTML
  in your pages from external files, which is great for putting the
  same signature or navigation map on all your pages.
  Below a signature is included automatically:<BR>
  <HR>
  <!--#include file="signature.txt" -->
  <HR>
  <!--#include virtual="/web/help/signature.txt" -->
  <HR>
  Although those two versions of "include" reach the same file,
  "include file" looks in the current directory (the name must
  not start with /, ., or ..) and "include virtual" starts in
  the root directory of your kiosk (so the name must start with
  "/".)  You might want to make a "/includes" directory in your Kiosk
  and then you can say "include virtual="/includes/file.txt"" from
  any page.  The "virtual" and "file" parameters are also used
  with "fsize" and "flastmod".  With either method, you can only
  reference files that are within your Kiosk directory.
</P>

<H3>file sizes and modification dates</H3>

<P>
  How large is a file?  "fsize" and "config sizefmt" will tell us:<BR>
  <!--#config sizefmt="bytes" -->
  index.html is <!--#fsize file="index.html" --> bytes.<BR>
  <!--#config sizefmt="abbrev" -->
  index.html is <!--#fsize file="index.html" -->.<BR>
  And we can find out how old a file is with "flastmod":<BR>
  And it was last changed on <!--#flastmod file="index.html" -->.
</P>

<H3>CGIs</H3>
<P>
  You can call a CGI which returns a chunk of text with "exec cgi":<BR>
  <HR>
  <!--#exec cgi="/Newbury/TheWorld/cgi-bin/uptime.cgi" -->
  <HR>
</P>

<H3>error messages</H3>

<P>
  Here is the default error message, generated by three bad SSI commands:<BR>
  <!--#include virtual="/no-such-directory/theres-no-file-by-this-name.html" --><BR>
  <!--#echo blurp="garble" --><BR>
  <!--#gorf --><BR><BR>
  And now we're going to make our own error message instead (I don't know
  why you'd want to, but you can):<BR>
  <!--#config errmsg="You bozo, you put some bad SSI commands in this file." -->
  <!--#include virtual="/no-such-directory/theres-no-file-by-this-name.html" --><BR>
  <!--#echo blurp="garble" --><BR>
  <!--#gorf -->
</P>



Our other SSI help:
Working examples of SSIs
Basic SSI documentation



(@) THE WORLD
Comments? Questions? Problems? Contact us.
Page last modified February 14, 2003.
Web site contents & design Copyright © 2003 Software Tool & Die.
Legal info.