Webhosting Promotion Submission Virtual Server Servers Web Design Web Graphic Design Internet Marketing Bulletin Boards BBS sysop webhosting secure
Moving Sites

Connection Help

Forms Help

Advanced Forms
Help


SSI Help

My SQL help

PHP help



Front Page
Frontpage FAQ

Frontpage
Tutorial


Page 1

Page 2

Page 3


Help Home

Opt2 Home




Server Side Includes

Support for server side includes (SSI) is standard with all web accounts. SSI allows you to create your HTML pages in a "modular" form, 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. If your site is over 5 pages, you really should learn how to use SSI. 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. For Example:

    <!--#include virtual="/header.shtml" -->
    <!--#include virtual="/intro.shtml" -->
    <!--#include virtual="/cgi-bin/myscript.cgi" -->
    <!--#include virtual="/footer.shtml" -->

In the case above, you can see you'll create a single page for display to the web visitor using 3 subpages and the results of a script. This way, every page would call the same "header.shtml" and "footer.shtml" files, but only the "guts" of the page would change. This allows you to easily update the page by making only changes to the header or footer files, but this change would be repeated in every page that called them.

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_REFERERThe page from which the visitor came (none)
HTTP_USER_AGENTThe visitor's browser softwareMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
SERVER_SOFTWAREThe version of the web serverApache/2.4.41 (Ubuntu)
SERVER_NAMEYour server nameopt2.net
REMOTE_ADDRThe remote IP address of the visitor3.149.242.223
REMOTE_USERThe username (in a restricted area)(none)
QUERY_STRINGAny data following a '?' in the URL
DOCUMENT_NAMEThe name of this filessi.shtml
DATE_LOCALThe current date (pacific time)Saturday, 21-Dec-2024 17:23:23 PST
DATE_GMTThe current date (GMT)Sunday, 22-Dec-2024 01:23:23 GMT
LAST_MODIFIED"Last modified" date of the current fileThursday, 29-Jun-2000 02:07:55 PDT


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
%cThe time and dateSaturday, the 21 of Dec, 2024<br>05:23:23PM
%RThe time (hh:mm)17:23
%TThe time (hh:mm:ss)17:23:23
%rThe time (hh:mm:ss AM)05:23:23 PM
%HThe hour (24-hour clock, 00-23)17
%kThe hour (24-hour clock, 0-23)17
%IThe hour (12-hour clock, 01-12)05
%lThe hour (12-hour clock, 1-12) 5
%MThe minutes (00-59)23
%SThe seconds (00-59)23
%pAM or PMPM
%sThe number of seconds since January 1, 19701734830603
%ZThe time zonePST
%DThe date12/21/24
%aThe abbreviated weekday name (Mon, Tue, ...)Sat
%AThe full weekday name (Monday, Tuesday, ...)Saturday
%wThe weekday number (0-6), 0=Sunday6
%BThe abbreviated month name (Jan, Feb, ...)December
%bThe full month name (January, February, ...)Dec
%mThe month of the year (01-12)12
%dThe day of the month (01-31)21
%eThe day of the month (1-31) 21
%yThe 2-digit year24
%YThe 4-digit year2024
%CThe century20
%jThe day of the year (001-366)356
%WThe week of the year (00-53) starting Monday51


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)

    Opt2.Net 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.

If you want to view how this page called the various functions and other files, Click Here to see the source code.