Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


SSI Directives

October 4, 1999

All SSI directives are formatted as SGML comments within an HTML document and thus looks something like the following:

          <!--#command tag1="value1" tag2="value2" -->

There are several possible commands that you can use including the following:

config Controls various aspects of the file parsing. There are two valid tags:

  • errmsg controls what error message is sent back to the client if a problem occurs while parsing the document.
  • timefmt defines the format a server should use when providing dates. These formats follow the standard UNIX formatting rules. Thus, >!--#config timefmt="%A, %B %d, %Y"--< would give you something like Friday, August 12, 1999. Other useful formatting include:

    %% - %
    %a - Day of the week abbreviation (Like TUE)
    %A - Full name of day of the week (Like SUNDAY)
    %w - Number of day of the week. Don't forget that Sunday is day 0.
    %b - Month abbreviation (Like MAR)
    %B - Full name of month (Like March)
    %d - The day of the month (01-31)
    %e - The day of the month (1-31)
    %H - Hour of day (00-23)
    %I - Hour of day (01-12)
    %j - Day in the year (001-366)
    %M - Minute (00-59)
    %p - AM or PM
    %S - Second (00-61)
    %ys Last two digits of the year (00-99)
    %Y - The year (Like 1999)
    %Z - The time zone (Like PST)

  • sizefmt defines the format a server should use when displaying the size of a file.
include Inserts the text of a separate document into the parsed document. For example, if you had a menu bar on every page, rather than coding the same HTML into every page on your site (Q: what happens if you change the menu? A: You'd have to recode every document!) you might write the HTML for the menu bar in a separate file and use SSI to reference it in multiple documents using something like: <!--#include virtual="menu.html" --> The include command accepts two tags:

  • virtual defines a virtual path to a document on the server.
  • file gives a pathname relative to the current directory.
echo Prints the value of one of the 6 special include variables.

  • DOCUMENT_NAME: The current filename.
  • DOCUMENT_URI: The virtual path to this document.
  • QUERY_STRING_UNESCAPED: The unescaped version of any search query the client sent, with all shell-special characters escaped with \.
  • DATE_LOCAL: The current date, local time zone. (This variable is subject to the timefmt parameter to the config command)
  • DATE_GMT: Same as DATE_LOCAL but in Greenwich mean time.
  • LAST_MODIFIED: The last modification date of the current document. (Subject to timefmt like the others).

Note that any dates are formatted according to timefmt if set by config. Also note that the only valid tag to this command is var, whose value is the name of the variable you wish to echo.

fsize Prints the size of the specified file. The valid tags for this command are the same as those of the include command and the resulting format of this command can be defined by the sizefmt parameter in the config command.
flastmod Prints the last modification date of the specified file, subject to the formatting defined by the timefmt parameter in config. Valid tags are the same as with the include command.
exec Executes a given shell command or CGI script. Valid tags include:

  • cmd will execute the given string using the operating system shell on which the web server is running.
  • cgi will execute the given CGI script and include its output.

SSI (Server Side Includes)
Introduction to the Web Application Development Environment (Tools)
SSI Directives Cont.


Up to => Home / Authoring / Tools / Tutorial




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers