Hack to use any doctype you want in cascade including html5

turnerjd's Avatar

turnerjd

02 Jun, 2010 05:08 PM

This assumes you are using php on your webserver , if not you’ll have to figure out how to buffer the output in your language.

In your templates add the following code before the starting tag:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<!--#START-ROOT-CODE    
<?php
ob_start();
?> 
#END-ROOT-CODE-->
<!--#START-CODE    
<?php
ob_end_clean();
echo '<!DOCTYPE html>';
echo '<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">';
?> 
#END-CODE-->

This starts php output buffer then allows you to discard it and post what ever doctype you want.

  1. 1 Posted by turnerjd on 02 Jun, 2010 05:10 PM

    turnerjd's Avatar

    here's a link to a cleaner code example http://gist.github.com/422679

  2. Support Staff 2 Posted by Tim on 04 Jun, 2010 04:03 PM

    Tim's Avatar

    Thanks for sharing!

  3. Tim closed this discussion on 04 Jun, 2010 04:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac