Server Side Includes

May 8, 1996
Michael Goshorn
Monday, 07-Oct-2002 10:53:22 MDT

Overview

  1. Client-Server Basics
  2. Server-Side-Include Definition
  3. Server-Side-Include (SSI) Format
  4. Commands
  5. Command Tags
  6. Environment Variables
  7. References

  1. Client-Server Basics
  2. The program requesting the document (Netscape, Mosaic, Lynx, etc) is called the client.

    The program that takes the request and returns the page is called the server.

    Most servers are not just limited to grabbing a home page from the disk and sending it back. They can search through the page requested by the client for special commands they recognize. This is called "parsing" the document.

    In order for the server to do this, it must be told to do so. By default, most servers do not parse a document before sending it.

    FortNet Instructions:

    Use the extension "shtml" rather than "html" for files you wish parsed.
    (Although all html files are currently parsed, this may not always be the case.)


    Top

  3. Server-Side-Include Definition
  4. A Server-Side-Include is simply some

  5. Server-Side-Include (SSI) Format
  6. <!--#command tag1="value1" tag2="value2" -->

    Although this looks a lot like a comment, the results are quite different.

    All directives to the server are formatted as SGML comments within the document.

    Each command takes different arguments, most only accept one tag at a time.
    (Make sure there is no space before the # sign)

    The results of the directive are inserted into the html document at the point of your include statement.


    Top

  7. Commands
    1. include
    2. echo
    3. exec
    4. config
    5. flastmod
    6. fsize

  8. Command Tags
    1. include

    2. include will insert the text of a document into the parsed document. Any included file is subject to the usual access control. This is the directive used on many of the current FortNet pages for the trailer.

      This command accepts two tags:

      Example: <!--#include virtual="/FortNet/includes/fortnet_owned.html"-->
      Includes the code to produce the trailer on FortNet pages

      Example: <!--#include file="sample.txt"-->
      Produces:
      This is some text from the file sample.txt. Included text may be html code as well.

    3. echo
    4. prints the value of one of the include environment variables. Any dates are printed subject to the currently configured timefmt. The only valid tag to this command is var, whose value is the name of the variable you wish to echo. The variable link above displays a page with each environment variable and the results of entering the variable in an echo directive.

      Example: <!--#echo var="LAST_MODIFIED"-->
      Produces: Monday, 07-Oct-2002 10:53:22 MDT

    5. exec
    6. executes a given shell command or CGI script in your local directory. Valid tags are:

    7. config

    8. The config directive controls various aspects of the file parsing. There are three valid tags:

    9. fsize
    10. prints the size of the specified file. Valid tags are the same as with the include command. The resulting format of this command is subject to the sizefmt parameter to the config command.


      Example: <!--#fsize file="echovar.shtml"-->

      Fortnet Response: 5.6K

    11. flastmod
    12. prints the last modification date of the specified file, subject to the formatting preference given by the timefmt parameter to config. Valid tags are the same as with the include command.


      Example: <!--#flastmod file="echovar.shtml"-->

      Fortnet Response: Monday, 07-Oct-2002 10:58:33 MDT

  9. Environment Variables
  10. References


Top


Home | Search | Help | Feedback

Copyright © 1998-2001 FortNet Inc.