4D WebSTAR SSI Demo

The WebSTAR SSI Plug-In allows you to use a wide range of "server-side include" commands in your HTML pages. It can show and hide information based on various conditions, display and increment counters, display file information, include other text or HTML files, execute CGI applications and include their output, and display a wide variety of information about the server, the client, and the data transferred between them. Most of these commands follow the
SSI specification established by the NCSA; the WebSTAR SSI Plug-In extends this set by adding a few extras, like the show and hide commands, counter commands, access to the WebSTAR API parameters, and automatic conversion of special characters.

To see how the commands on this page are used, open the "ssi_demo.shtml" file in a text editor. Select "View Source" in your browser to see how this file is modified by the WebSTAR SSI plug-in before being sent to the browser.


ECHO VALUES

You can display a wide variety of information using the #echo command - Click on this link to display some of these parameters:
Load this page again

Most of the standard NCSA SSI parameters can be used (those not implemented are noted):

  • (Not Implemented):
    AUTH_TYPE = Not implemented.
  • Content Length as sent in HTTP Header:
    CONTENT_LENGTH = 0
  • Content Type as sent in HTTP Header (usually specified only when sent from an HTML form):
    CONTENT_TYPE = Empty variable value.
  • GMT Date and Time:
    DATE_GMT = 2008/07/04:00:55:41
  • Local Date and Time:
    DATE_LOCAL = 2008/07/04:00:55:36
  • Path and Name of this file:
    DOCUMENT_NAME = ssi_demo.shtml
  • URI of this file (on disk, not relative to server):
    DOCUMENT_URI = /Examples/SSI/ssi_demo.shtml
  • Interface of this SSI plug-in:
    GATEWAY_INTERFACE = W*API (version 2)
  • MIME-types accepted by browser:
    HTTP_ACCEPT = Accept: application/xhtml+xml,text/html;q=0.9,text/plain;
  • WWW Client Software identification presented:
    HTTP_USER_AGENT = CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
  • Date this file was last modified:
    LAST_MODIFIED = 2004/06/15:20:57:18
  • Path arguments (the part of the URL after the "$" symbol):
    PATH_INFO = Empty variable value.
  • URL decoded path arguments:
    PATH_TRANSLATED = Empty variable value.
  • Query arguments (the part of the URL after the "?" symbol):
    QUERY_STRING = Empty variable value.
  • URL decoded query arguments:
    QUERY_STRING_UNESCAPED = Empty variable value.
  • Username passed by client (an obsolete value used only by very old browsers):
    REMOTE_USER = Empty variable value.
  • HTTP Request method:
    REQUEST_METHOD = GET
  • Name and URL path of the requested file:
    SCRIPT_NAME = /Examples/SSI/ssi_demo.shtml
  • Server's port number:
    SERVER_PORT = 80
  • HTTP Protocol used by server:
    SERVER_PROTOCOL = HTTP/1.1
  • Server Software:
    SERVER_SOFTWARE = 4D_WebSTAR_S/5.3.3 (MacOS X)

  • The #echo command can also be used to display special values, such as the current random number, the current value of any counter variables created by the #counter command, or any named variables created by the #store command (see the sections on "COUNTERS" and "STORED VARIABLES" for examples of how to display these values):

    Show current random number: 76


    INCLUDE FILE

    With the #include command, you can display the contents of a text or HTML file:


    Sample HTML File

    A selection from The Three Musketeers, by Alexandre Dumas:

    'Pray,' said d'Artagnan, 'does the king usually give you his reasons? He tells you bluntly--gentlemen, they are fighting in Gascony, or in Flanders; go, and fight; and you go. As for any reasons--you do not trouble your heads about them.'

    'D'Artagnan is right,' said Athos. 'Behold our three leaves of absence, which come from M. de Treville; and here are three hundred pistoles, which come from I know not where. Let us go and be killed where we are told to go. Is life worth so many questions? D'Artagnan, I am ready to follow you.'



    FILE INFORMATION

    The #fsize and #flastmod commands will display size and date last modified for any file:

    File Size of the sample file included below: 781 bytes
    File Modified: 2004/06/15:20:57:18


    COUNTERS

    Using the #counter and #echo commands, you can increment and display the values of various counters:

    Counter 1 is: 836
    Display the current value of Counter 1: 836

    Counter 2 is: 2506
    Counter 2 incremented again without displaying it:
    Counter 2 incremented once again: 2508


    SHOW AND HIDE

    The SSI plug-in's #show and #hide commands can be used with a number of criteria:

    Show only to Netscape and compatibles:
    (based on http_user_agent = "CCBot/1.0 (+http://www.commoncrawl.org/bot.html)")

    Show after February 1998: Hello!
    (based on date_local = "2008/07/04:00:55:36")

    Show 40 percent of the time:
    (based on random = "76")

    Change random numbers and show either a green, yellow, or red square:
    (Based on random = "2")


    More sample #show and #hide commands:

    Show if the time is after noon:
    (Based on date_local = "2008/07/04:00:55:36")

    Don't show if this page is accessed directly, only when reached from a hyperlink (try reloading) :

    Hide only if the QUERY_STRING is "Frans Hals" (follow this reload link): Empty variable value. Hello!
    (Based on query_string_unescaped = "Empty variable value.")


    STORED VARIABLES

    Display the current contents of the variable named "fruit":
    The WebSTAR SSI plug-in also performs conversion of special characters in your HTML pages. You can set the default character translation option in the Server Settings - Web Settings - SSI screen of the WebSTAR Admin application, but you can also control the character translation for individual pages with a #config command. WebSTAR SSI allows you to translate special characters to the equivalent ISO Latin-1 entities, leave characters untranslated, or to restrict the character set to 7-bit ASCII:

    ISO Latin-1 conversion:

    Français Español Português

    Unconverted 8-bit characters:

    Franais Espa–ol Portugus

    ASCII character set:

    Fran ais Espaol Portugus