Server side includes

Support for server side includes (SSI) is standard with all web accounts. SSI allows you to "piece together" an HTML file on-the-fly using the various tools below. When used creatively, SSI can enable you to manage and edit your site's "look & feel" by changing only a few files. SSI is NOT compatible with Microsoft FrontPage.

Including other files
    You can dynamically include files within your .shtml documents using the following syntax. These files may be static HTML files, static text files, freeCGI programs, or custom CGI programs:

    <!--#include virtual="/myfile.html" -->
    <!--#include virtual="/cgi-bin/myscript.cgi" -->
Global variables

    The following useful variables are available from within SSI.
    For a complete list of variables, please use the <!--#printenv --> command.

    To place a variable within a .shtml file, use the following code:
    <!--#echo var="VARIABLE_NAME" -->

Variable Meaning Sample
HTTP_REFERER The page from which the visitor came http://www.manicdesign.com/support/
HTTP_USER_AGENT The visitor's browser software Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
SERVER_SOFTWARE The version of the web server Apache/1.3.6 (Unix)
SERVER_NAME Your server name www.manicdesign.com
REMOTE_ADDR The remote IP address of the visitor 216.244.48.164
REMOTE_USER The username (in a restricted area) (none)
QUERY_STRING Any data following a '?' in the URL  
DOCUMENT_NAME The name of this file ssi.shtml
DATE_LOCAL The current date (pacific time) Tuesday, 12-Sep-2000 12:05:11 PDT
DATE_GMT The current date (GMT) Tuesday, 12-Sep-2000 19:05:11 GMT
LAST_MODIFIED "Last modified" date of the current file Monday, 18-Jan-1999 22:26:49 PST


File size

    You can show the size of the current document within your .shtml file:
    <!--#config sizefmt="bytes" --> (for size in bytes)
    <!--#fsize -->

    or

    <!--#config sizefmt="abbrev" --> (for size in Kb or Mb)
    <!--#fsize -->
Timestamps

    Using SSI, you can place timestamps within your documents.

    First, specify a time format using the variables below:
    <!--#config timefmt="%I:%M:%S%p" -->

    Then, print out a time using echo (above), i.e.:
    <!--#echo var="DATE_LOCAL" -->
    <!--#echo var="LAST_MODIFIED" -->
Code Meaning Sample
%c The time and date Tue Sep 12 12:05:11 2000
%R The time (hh:mm) 12:05
%T The time (hh:mm:ss) 12:05:11
%r The time (hh:mm:ss AM) 12:05:11 PM
%H The hour (24-hour clock, 00-23) 12
%k The hour (24-hour clock, 0-23) 12
%I The hour (12-hour clock, 01-12) 12
%l The hour (12-hour clock, 1-12) 12
%M The minutes (00-59) 05
%S The seconds (00-59) 11
%p AM or PM PM
%s The number of seconds since January 1, 1970 968785511
%Z The time zone PDT
%D The date 09/12/00
%a The abbreviated weekday name (Mon, Tue, ...) Tue
%A The full weekday name (Monday, Tuesday, ...) Tuesday
%w The weekday number (0-6), 0=Sunday 2
%B The abbreviated month name (Jan, Feb, ...) September
%b The full month name (January, February, ...) Sep
%m The month of the year (01-12) 09
%d The day of the month (01-31) 12
%e The day of the month (1-31) 12
%y The 2-digit year 00
%Y The 4-digit year 2000
%C The century 20
%j The day of the year (001-366) 256
%W The week of the year (00-53) starting Monday 37


Setting variables

    You can set variables for use in later echo statements:
    <!--#set var="VARIABLE_NAME" value="VARIABLE_VALUE" -->

    You can then print these variables using the following syntax:
    <!--#echo var="VARIABLE_NAME" -->
Parsing non-SSI file types

    Only .shtml files should include SSI tags. In some cases, however, you may wish to have the webserver scan .html files for SSI tags as well. To do so, add the following line to the .htaccess file in your document root:

    AddType text/x-server-parsed-html shtml html htm

    Where shtml, html, and htm are file types to scan for SSI tags. Use this with caution; on a busy site, this may lead to noticable performance degradation.
XSSI (eXtended Server Side Includes)

    Manic uses the Apache webserver which supports the XSSI standard (the embedding of conditional statements within SSI). For more information on XSSI, or for the latest supported SSI enhancements, please visit the Apache webserver SSI documentation.

Main | Signup | Hosting | Design | Webmaster Resources | Contact Us!




Copyright © 1996-2000, Manic Design
support@manicdesign.com