HTML
  Home arrow HTML arrow Page 3 - Using SSI to Boost Efficiency
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Using SSI to Boost Efficiency
By: Clay Dowling
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 7
    2004-08-16

    Table of Contents:
  • Using SSI to Boost Efficiency
  • Enabling SSI
  • Simple SSI Directives
  • How to Use SSI
  • Navigation Menus
  • Common HTML Blocks
  • Business Considerations

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using SSI to Boost Efficiency - Simple SSI Directives


    (Page 3 of 7 )

    As the name implies, SSI allows a web designer to insert the contents of one file into another when the file is served up. Other information can also be inserted, including file modification dates, file sizes and values of server environment variables. The general form of all directives is:

    <!--#element attribute=value attribute=value ... -->

    Because it's wrapped in a comment, if your server isn't configured to support SSI, the content will be exported normally and your browser will treat it just like any other HTML comment. If you're using a syntax checking editor, this will prevent it from choking on your directive.

    Including Files

    To include one file in the output of another, use the #include directive:

    <!--#include virtual="/virtual/url/to/file" -->

    If you've used SSI before or if your working on IIS, the "virtual" attribute may look a little funny to you. It isn't the file system path to a file but is a URL on the local server to the file. This makes your SSI files easier to move around on the file system and from server to server.  The "file" attribute is still supported but "virtual" is greatly preferred.  If you persist in using "file", you may run into trouble when you move your site from the development server to production.

    File Modification Time

    File modification times are useful when you're offering files for download. When the new file is uploaded to the server, the web page will automatically reflect the new modification time.

    <!--#flastmod file="download.zip" -->

    This directive can also be used to mark a page with its own last modification date by including the file name as the "file" directive.  While there are other ways to handle this, such as a version control system, it's a pretty good work around for providing the information.

    Executing Commands

    The output of programs run on the server can also be included.  The classic example is to produce a file listing.  I've also used it for web page counters and for generating dynamic menus on my web site.

    <!--#exec cmd="menu.pl" -->

    The command is executed in the system's default shell and inherits all of the environment variables available to a CGI program. This feature is potentially very dangerous and should be disabled site wide if users can contribute content to the web site, such as via a guest book.  For Apache, adding IncludeNOEXEC to the Options directive where you enabled SSI. For IIS, the feature is disabled by default and must be turned on.

    Displaying Environment Variables

    You can display any environment variable using the following directive:

    <!--#echo var="variable" -->

    It's useful for displaying any of the variables which are available to CGI programs.

    Setting Environment Variables

    It's useful to be able to set environment variables. You can use it to set certain options in CGI programs called by the #exec directive. You can also set variables in one file that are displayed in another included file using the #echo directive.

    <!--#set var="name" value="value" -->

    Unfortunately you can't use this feature on IIS.  That means one of the examples coming up won't be useful for IIS users.

    More HTML Articles
    More By Clay Dowling


     

    HTML ARTICLES

    - Using a 3D HTML Table as a Recordset
    - Building a 3D HTML Table
    - Maximizing and Restoring HTML Images: Layer ...
    - Completing Construction of a Database Form w...
    - Maximizing and Restoring Images in a Tabular...
    - Building the Recordset for an HTML Database ...
    - Laying Out a Database Form with HTML
    - Tabular Database Form Functions with HTML
    - Tabular Database Forms with HTML
    - Using the Find Functions for HTML Database F...
    - Sorting for Database Forms with HTML
    - Edit and Other Database Form Functions with ...
    - More Database Form Functions with HTML
    - Database Form Functions with HTML
    - Using the HTML Table Element as a Recordset






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT