If your website is modular you would define the doctype in the module. Have the page load check the modules doctype and then use a switch statement in your header.
global $somemodulename;
if (($somemodulename == Music)
{
if(@file_exists(module/somemodulename/includes/doctype.php'))
{
require_once(module/somemodulename/includes/doctype.php');
}
}
Parsing the module Sub Folder on load for doctype.php above can be done a lot different I am just trying to explain the concept.
switch ($doctype)
{
case 'HTML':
$output = '<!DOCTYPE html>'."\n";
$output .= '<meta charset="UTF-8">'."\n";
define('DOCTYPE', 'HTML');
break;
case 'strict':
$output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
define('DOCTYPE', 'strict');
break;
case 'transitional':
$output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
define('DOCTYPE', 'transitional');
break;
case 'frameset':
$output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">';
define('DOCTYPE', 'frameset');
break;
case 'math':
$output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">';
define('DOCTYPE', 'math');
break;
case 'xhtml11':
$output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
define('DOCTYPE', 'xhtml11');
break;
case 'default':
$output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
define('DOCTYPE', 'transitional');
break;
}
I already use this in PHP-Nuke Titanium and it works fine. My code is a little more elaborate but you get the gist of what I am saying. I use the doctype switch to test browser code. I took it from my browser workbench. This is used to make old modules written by other people compatible with PHP-Nuke Titanium.
You can have your header so that it is called separate if your website is not modular. That way each page load sets the modulename or pagename and the header invokes the switch on the fly.
You can embed PHP code into HTML and Vice Versa :)
This concept can be used to do exactly what you asked. I know this post was old but we all need to share our ideas. Cheers