About the Code

6/6/00 - This site uses for its navigation and templates. PHP is a server-side, cross-platform, HTML embedded scripting language similar to or , except that it's . Its also used to control the fonts and popup windows.

To begin with, the site was originally developed in HTML, QA'd on PC, MAC and Linux versions of MSIE 4 and 5 and Netscape 3 thru 6. The HTML tries to be 4.0 compliant, but interoperability requires some illegal tags. Also, since is still not properly implemented, it is avoided altogether.

The pages themselves become amazingly simple using PHP; just set page variables, include your library pages, and then include header, nav and footer files:
    <?
    // Page Variables
    $page_title = "- About the Code";
    
    // Library files
    include ("../lib/page.lib"); // page default variables
    include ("../lib/font.lib"); // Font Adjuster
    
    include ("../tpl/header.tpl"); 
    include ("../tpl/nav.tpl"); 
    
    ?>
    <!-- Page Contents Begin Here -->
    
    <!-- Page Contents End Here -->
    <?
    include ("../tpl/footer.tpl"); 
    ?>

The code above is from this page (view source won't work - you can't see it unless you go to the server). Elements within the page are handled by Calling a function from a library file.

Therefore, the tag:
    <?print "$Font $FontColorBodyLink $FontSizeLarger";?>
will produce the following html:
    <font color='#006600' size=4>
because it called $Font, $FontColorBodyLink and $FontSizeLarger from the library file font.lib. Now, you may be saying "but that's more code, not less! How is this more efficient?"

Well, lib/font.lib has the following code in it: (arrows show the code we use)
    <?        
 ==>$Font = "<font";
    $FontFace = "face=\"arial, helvetica, sans-serif\"";
    $FontFaceFun = "face=\"comic sans MS\"";
    $FontColorNav = "color=\"#66FF66\"";
    $FontColorLink = "color=\"#ffff00\"";
    $FontColorBody = "color='#000099'";
 ==>$FontColorBodyLink = "color='#006600'";
    
    if ( eregi("mac",$HTTP_USER_AGENT)) { 
        $FontSizeNone = ">";
        $FontSizeSmall = "size=2>";
        $FontSizeMedium = "size=3>";
        $FontSizeLarge = "size=4>";
 ==>    $FontSizeLarger = "size=5>";
        $FontSizeLargest = "size=6>";
    } else {
        $FontSizeNone = ">";
        $FontSizeSmall = "size=1>";
        $FontSizeMedium = "size=2>";
        $FontSizeLarge = "size=3>";
 ==>    $FontSizeLarger = "size=4>";
        $FontSizeLargest = "size=5>";
    }
    ?>

So you can see that a MAC user would not see
     <font color='#006600' size=4>

They would see:
    <font color='#006600' size=5>

Also, changing all of the fonts and colors for the site can be accomplished in one file, rather than doing a sweep of the site.

PHP makes it easy to handle additional pages and dynamic navigation as well, and integrates beautifully with any ODBC database, but this page is long enough. See Navigation.

~Joe K


Questions? Comments? Send them to Joe K