Page is a not externally linkable
- Code, Content, and Presentation
-- HTML
---- Polyglot Markup: HTML-Compatible XHTML Documents


swa66 - 11:31 pm on Jul 26, 2012 (gmt 0)


I've been doing some php scripts that output polyglot xhtml5

Some interesting bits other might find useful:
NOTE: I'm not the best php programmer ever - feel free to correct/add

Output the content-type if the browser is not retarded - obviously do this before outputting anything:

if(stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")){
header('Content-Type: application/xhtml+xml;charset=UTF-8');
}


function to use instead of htmlentities() so it's only converting the 5 allowed named entities:

function myxmlencode($str) {
$in= array ('&','<','>','"',"'");
$out= array ('&amp;','&lt;','&gt;','&quot;','$apos;');
return(str_replace($in, $out, $str));
}


Thread source:: http://www.webmasterworld.com/html/4461446.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com