[thelist] HTML optimization advice, please

Ray Hill ray at opengrid.com
Thu Sep 20 13:49:55 CDT 2001

> Optimize (for maintenance) the "Header" and "Footer" sections,
> through SSI or other.

Use PHP to print the header/footer content.  Since you can make the printing
of said content into a function, it would eliminate the need for 40
different files, and could instead be just a switch statement within the
function that prints different content depending on which sectionid you pass

You can configure your server to parse your existing .html files as PHP, so
you shouldn't have to change your file names.  And since PHP works on both
IIS and Apache, porting it over to a different machine type in the future
would not be a problem (and might actually be a benefit, since PHP runs
faster as an Apache module).

Something like this:

include "template.php";

<!-- Content goes here -->


function template_printHeader($mySectionID) {
    switch ($mySectionID) {
      case "SectionOne":
        // Print content for this section here.
      case "SectionTwo":
        // Print content for this section here.
        // Print default section content here.
  <body bgcolor="#FFFFFF">
  <!-- Formatting/navigation table goes here -->
  <table border="" cellpadding="" cellspacing="">

function template_printFooter($mySectionID) {

This also allows you to set other variables in the switch statement that can
be referred to further down in the individual documents' content.  And, of
course, you can distill the navigation dropdowns into their own file and/or
function  and include them into the template file, to make it easier to


More information about the thelist mailing list