[thelist] HTML optimization advice, please

Tyme nopun at bellsouth.net
Thu Sep 20 20:22:47 CDT 2001


Sounds like a good alternative!  Now, what are the chances of me learing PHP
and converting all 400 files by Monday, Sept. 24th.

----- Original Message -----
From: Ray Hill <ray at opengrid.com>
To: <thelist at lists.evolt.org>
Sent: Thursday, September 20, 2001 2:45 PM
Subject: RE: [thelist] HTML optimization advice, please


> > TASK:
> > Optimize (for maintenance) the "Header" and "Footer" sections,
> > through SSI or other.
>
> APPROACH #3:
> 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
> it.
>
> 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:
>
>
> SAMPLE_PAGE.HTML
> <?
> include "template.php";
> template_printHeader("ThisSectionID");
> ?>
>
> <!-- Content goes here -->
>
> <?
> template_printFooter("ThisSectionID");
> ?>
>
>
>
> TEMPLATE.PHP
> <?
> function template_printHeader($mySectionID) {
>   ?>
>   <html>
>   <head>
>     <?
>     switch ($mySectionID) {
>       case "SectionOne":
>         // Print content for this section here.
>         break;
>       case "SectionTwo":
>         // Print content for this section here.
>         break;
>       default:
>         // Print default section content here.
>         break;
>     }
>     ?>
>   </head>
>
>   <body bgcolor="#FFFFFF">
>
>   <!-- Formatting/navigation table goes here -->
>   <table border="" cellpadding="" cellspacing="">
>     <tr>
>       <td>
>   <?
> }
>
> function template_printFooter($mySectionID) {
>   ?>
>       </td>
>     </tr>
>   </table>
>
>   </body>
>   </html>
>   <?
> }
> ?>
>
>
>
> 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
> manage.
>
>
> --ray







More information about the thelist mailing list