Home arrow HTML arrow Page 6 - Using SSI to Boost Efficiency
HTML

Using SSI to Boost Efficiency


Have you always thought Server Side Includes (SSI) was too complex? Check out Clay Dowling's tips as he explains some simple SSI directives and how to simplify managing navigation menus.

Author Info:
By: Clay Dowling
Rating: 4 stars4 stars4 stars4 stars4 stars / 9
August 16, 2004
TABLE OF CONTENTS:
  1. · Using SSI to Boost Efficiency
  2. · Enabling SSI
  3. · Simple SSI Directives
  4. · How to Use SSI
  5. · Navigation Menus
  6. · Common HTML Blocks
  7. · Business Considerations

print this article
SEARCH DEVARTICLES

Using SSI to Boost Efficiency - Common HTML Blocks
(Page 6 of 7 )

There are blocks of common code I have used on my website. Support for many of my downloadable scripts can be purchased through PayPal. Likewise, these scripts are listed on script sites that have a rating system. The code blocks for both are a little tedious and very similar across all pages.

Part of the problem here is that the blocks are similar, not identical. For IIS users, this means you're out of luck.  For Apache users though, the combination of #set and #echo directives are useful. The block for the script rating site is below:

<!-- Script ranking block -->
<form action="
http://www.scripts.tld/cgi-bin/rate.cgi" method="POST">
<input type="hidden" name="ID" value="20656">
<table BORDER="0" CELLSPACING="0" bgcolor="#800000"><tr><td>
<table border="0" cellspacing="0" width="100%" bgcolor="#EFEFEF" cellpadding="3"><tr><td align="center">
<font face="arial, verdana" size="2"><b>Rate Our Script</b></font></td>
<td align="center">
<select name="ex_rate" size="1">
 <option selected>Select</option>
 <option value="5">Excellent!</option>
 <option value="4">Very Good</option>
 <option value="3">Good</option>
 <option value="2">Fair</option>
 <option value="1">Poor</option>
</select>
</td>
<td align="center"><input type="submit" value="Go!"></td>
</tr></table>
</td></tr></table>
</form>

<!-- End of Script Ranking Block -->

The only part I'm really worried about here is the value of the ID form field.  That is the only part that will change from page to page.  Again, I cut the block of code out of my page and drop it into its own file, which I'll call "rateblock.shtml".  I replace the value of the ID field with an #echo directive, as demonstrated below in the code excerpt.

<!-- Automated Script Ranking Block -->
<form action="
http://www.scripts.tld/cgi-bin/rate.cgi" method="POST">
<input type="hidden" name="ID" value='<!--#echo var="SCRIPT_ID" -->'>
....

Now to put a rating block on one of my pages, I need a pair of directives in my page:

<!--#set var="SCRIPT_ID" value="12345" -->
<!--#include virtual="rateblock.shtml" -->

The block will appear in my pages with the proper value in the ID field. If you get a value of "(none)" in the ID field, you have a mismatch between the variable you set in your page and the value you are echoing in the included file. I lost several minutes trying to resolve that problem.


blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials