Welcome Guest, Not a member yet? Register   Sign In
xHTML Helper
#1

[eluser]Michael Wales[/eluser]
I'm always hitting Google to remember the syntax of the DOCTYPE declaration - or what the URL is to W3C's HTML namespace. So, I decided to whip up a quick little helper to assist in this - check it out on the Wiki (xHTML Helper).

If you are an HTML 4 kind of person, this helper will still prove useful as it includes doctype declarations for HTML 4, xHTML 1.0, and xHTML 1.1 (with error handling, in case you define an illegal pairing between language and DTD).

If you use xHTML 1.0 or xHTML 1.1 (like the rest of the sane development community) - you can also make use of the html function, which outputs a valid HTML tag with namespace defaulting to W3C's namespace, and the contentType function, which outputs a valid META tag declaring the Content-Type (defaulting to UTF-8).

Hope this makes someone's life easier - here's a quick snippet, where it's all put together (with a touch of my asset helper):

Code:
<?= xhtml_doctype(); ?>
<?= xhtml_html(); ?>
    <head>
        <?= xhtml_contentType(); ?>
        <?= css_asset('style.css'); ?>
        <title>MichaelWales.com</title>
    </head>
    <body>
        <div id="wrapper">
            <h1>MichaelWales.com</h1>
        </div>
    &lt;/body&gt;
&lt;/html&gt;


Messages In This Thread
xHTML Helper - by El Forum - 11-18-2007, 03:35 PM
xHTML Helper - by El Forum - 11-18-2007, 04:06 PM
xHTML Helper - by El Forum - 11-18-2007, 05:12 PM
xHTML Helper - by El Forum - 11-18-2007, 07:15 PM



Theme © iAndrew 2016 - Forum software by © MyBB