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):
<?= xhtml_doctype(); ?>
<?= xhtml_html(); ?>
<?= xhtml_contentType(); ?>
<?= css_asset('style.css'); ?>