Hello folks!  I've been lurking the last 200 messages or so (i.e. 10-15
minutes ;-) I've already learned a lot, including that this list will be
well worth the bandwidth.  I hope my post will be worth the reading.

I think I have my first contribution to make, and at the same time would
like to ask for suggestions/corrections/etc.  I recently started using PHP
at my personal site (www.tntluoma.com) after reading Core PHP PRogramming
and mySQL/PHP Database Applications this past weekend.

I wish I had known about it sooner!  I had already manually (well, using
global search/replace in UltraEdit) changed my site from HTML4 to
HTML4-Strict to XHTML1.  That was fun (NOT!)

Then I realized that some of my pages were in HTML4 strict, some in loose,
some XHTML-Strict, some XHTML-Loose, and even a few XHTML 1.1 for good
measure.  Before PHP, I had tried using SSI for defining DOCTYPEs, but
then it wouldn't validate anymore :-/  Then there were some of the pages
that validated, but the W3.org icon on the bottom of the page hadn't been
updated when I changed the DOCTYPE, so I had to go back again and work to
fix that.  This was != HOURS OF FUN  (and I won't even mention having to
then go back and make the DOCTYPE the first line to get IE6 to go into
standards mode).

Now that I'm using PHP (which is a TON faster than SSI on my site at
least) I have achieved what I think is a pretty excellent situation.  I
have:
        - an index.php that builds the page, calling external global files
that define doctype, global meta tags, etc as well as a set of bottom
navigational links and the W3 icons for (X)HTML and CSS validation
        - a body.html that holds the main text of the page
        - a header.html (optional) that includes local meta tags or CSS
for just that page
        - a footer.html (optional) that adds any navigational information
for that directory

        Ok, so thanks for reading all that.  I have created this:

        http://www.tntluoma.com/php/snippets/set-doctype.txt

        The code there looks for a variable $DOCTYPE and then sets the
DOCTYPE, the W3 image for validating, and a 'friendly name' which we can
use in ALT tags, etc.  For example

elseif ($DOCTYPE == "xhtml11")
{
        //XHTML 1.1
$DOCTYPE_NAME="XHTML 1.1";

$DOCTYPE_ICON='/global/xhtml/1.1/valid.gif';

$DOCTYPE='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";><html
xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">';
}


There is an 'else' to handle cases when no DOCTYPE is defined.

This will make it easy to define DOCTYPEs for specific pages that
need/want them, and if you want to change the XHTML doctype for IE6 or to
go with the full XML definition.

        Anyway, sorry for the long post.  I hope this is helpful to
someone else.  Comments/suggestions welcomed.

        TjL



-- 
Site: www.tntluoma.com                       mailto:[EMAIL PROTECTED]
Info: Apache/1.3.19 (Unix) with PHP/4.0.6
How does your webhost provider measure up to UCVHost?
See http://www.peak.org/~luomat/misc/tntluoma-uptime/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to