XHTML XHTML空白模板

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Conforming XHTML 1.0 Strict Template</title>
</head>
<body>

	<script src="http://www.google.com/jsapi"></script>
	<script type="text/javascript">
		google.load("jquery", "1.3.1");
		var page = {
			init: function() {
				// constructor code
			},
			isthisavalidpage: true
		};
		google.setOnLoadCallback(page.init);
	</script>
</body>
</html>

XHTML 有效的NOINDEX标签

<style type="text/css">
.inv {display:none;}
</style>

<del class="inv"><![CDATA[<noindex>]]></del>
noindex content
<del class="inv"><![CDATA[</noindex>]]></del>

XHTML XHTML骨架

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr">
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
		<title>${1:${TM_FILENAME/((.+)\..*)?/(?2:$2:Page Title)/}}</title>
		<link rel="${3:stylesheet}" href="${4:css/master.css}" type="text/css" media="${5:screen}" title="${6:no title}" charset="${7:utf-8}" />
	</head>
	<body>
		$0
	</body>
</html>

XHTML 典型的DOCTYPE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="newriverbridge-org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>[TITLE HERE]</title>
<meta http-equiv="Content-Language" content="en-us"/>
<meta http-equiv="imagetoolbar" content="false"/>
<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.1)"/>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<link rel="shortcut icon" href="../img/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" type="text/css" href="css/screen.css" media="screen, projection"/>
<link rel="stylesheet" type="text/css" href="css/enrich.css" media="screen, projection"/>
<link rel="stylesheet" type="text/css" href="../css/handheld.css" media="handheld"/>
<link rel="stylesheet" type="text/css" href="../css/print.css" media="print"/>
<!--[if IE]><link rel="stylesheet" type="text/css" href="css/ie.css" media="all"/><![endif]-->
<!--[if IE 6]><link rel="stylesheet" type="text/css" href="css/ie6.css" media="screen, projection"/><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" href="css/ie7.css" media="screen, projection"/><![endif]-->
</head>

XHTML XHTML + RDFa 1.0模板(外部DTD)

<?php 
header( 'Content-type: application/xhtml+xml' );
$xmldec = 	"<?xml version="1.0" encoding="utf-8"?>\n";
$xmldec .= 	"<?xml-stylesheet type="text/xsl" href="ie-xml-fix.xsl"?>\n";
echo html_entity_decode( $xmldec );
?>
<!DOCTYPE html PUBLIC 
	"-//W3C//DTD Custom XHTML+RDFa 1.1//EN" 
	"xhtml+rdfa-10e.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/terms/" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8" />

		<!-- Site & Page URL Meta -->
		<base href="#" />
		<link rel="canonical" href="#" />
		
		<!-- Caching Meta -->
		<meta http-equiv="expires" content="#" />
		<meta http-equiv="cache-control" content="#" />
		
		<!-- Language Meta -->
		<meta name="content-language" content="#" />
		<meta name="language" content="#" />

		<!-- Production Meta -->
		<meta name="author" content="" />
		<meta name="designer" content="" />
		<meta name="copyright" content="(c) YYYY. All Rights Reserved." />

		<!-- Site || Page Meta -->
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		
		<!-- Search Engine Meta -->
		<meta name="robots" content="noydir,noodp,nosnippet" />
		<meta name="googlebot" content="" />
		<meta name="msnbot" content="" />
		<meta name="slurp" content="" />
		
		<title>New XHTML + RDFa Document</title>
		
		<!-- Style Resources -->
		<link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset/reset-min.css" type="text/css" media="screen" />
		<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
		
		<!-- JavaScript Resources -->
		<!--[if lt IE 8]>
		<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
		<![endif]-->
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
	</head>
	<body>
		<h1>XHTML + RDFa!</h1>
		<p property="dc:created" content="YYYY-MM-DD">I am an XHTML document, extended by RDFa. Hello, world!</p>
		<p about="" resource="http://www.w3.org/TR/rdfa-syntax" rel="dct:conformsTo" xmlns:dc="http://purl.org/dc/terms/"><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml-rdfa-blue" alt="Valid XHTML + RDFa" longdesc="http://validator.w3.org/" /></a></p>
	</body>
</html>

********************************************************************
* 
* Filename: xhtml+rdfa-10e.dtd
*
********************************************************************

<!ATTLIST img longdesc CDATA #IMPLIED>

<!ENTITY % xhtmlrdfa PUBLIC 
	"-//W3C//DTD XHTML+RDFa 1.0//EN" 
	"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
%xhtmlrdfa;

XHTML XHTML + RDFa 1.0模板(用于生产)

<?php 
function is_ie() {
	$agent = '';
	// old php user agent can be found here
	if (!empty($HTTP_USER_AGENT))
		$agent = $HTTP_USER_AGENT;
	// newer versions of php do have useragent here.
	if (empty($agent) && !empty($_SERVER["HTTP_USER_AGENT"]))
		$agent = $_SERVER["HTTP_USER_AGENT"];
	if (!empty($agent) && preg_match("/MSIE/si", $agent))
		return true;
	return false;
}

if (is_ie() == 1) {
	//$xmldec .= "<?xml-stylesheet type="text/xsl" href="ie-xml-fix.xsl"?>\n";
	// See here for the fix: http://www.echoofeden.com/digest/mit/2007/03/06/ie-xhtml-bug/
	$script_include_close = "type=\"text/javascript\"></script>";
	$sic = $script_include_close;
	$mime_type = "text/html";
	$js_mine_type = "text/javascript";
	header( 'Content-type: '.$mime_type.'; charset=utf-8' );
} else {
	$xmldec = "<?xml version="1.0" encoding="utf-8"?>\n";
	$xmldec .= "<?xml-stylesheet type="text/css" href="http://yui.yahooapis.com/2.7.0/build/reset/reset-min.css"?>\n";
	$script_include_close = "type=\"application/x-javascript\" />";
	$sic = $script_include_close;
	$mime_type = "application/xhtml+xml";
	$js_mine_type = "application/x-javascript";
	header( 'Content-type: '.$mime_type.'; charset=utf-8' );
	echo html_entity_decode( $xmldec );
}
?>
<!DOCTYPE html PUBLIC 
	"-//W3C//DTD XHTML+RDFa 1.0//EN" 
	"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html 	version="XHTML+RDFa 1.0" 
	xmlns="http://www.w3.org/1999/xhtml" 
	xmlns:dc="http://purl.org/dc/terms" 
	xmlns:xhv="http://www.w3.org/1999/xhtml/vocab" 
	xmlns:media="http://purl.org/media" 
	xmlns:commerce="http://purl.org/commerce" 
	xmlns:audio="http://purl.org/media/audio" 
	xml:lang="en" 
	lang="en">

	<head>
		
		<meta http-equiv="Content-Type" content="<?=$mime_type?>; charset=utf-8" />

		<!-- Caching Meta -->
		<meta http-equiv="expires" content="#" />
		<meta http-equiv="cache-control" content="#" />
		
		<!-- Site & Page URL Meta -->
		<base href="#" />
		<link rel="canonical" href="#" />
		
		<!-- Language Meta -->
		<meta name="content-language" content="#" />
		<meta name="language" content="#" />

		<!-- Production Meta -->
		<meta name="author" content="" />
		<meta name="designer" content="" />
		<meta name="copyright" content="Copyright. YYYY. All Rights Reserved." />

		<!-- Site || Page Meta -->
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		
		<!-- Search Engine Meta -->
		<meta name="robots" content="noydir,noodp,nosnippet" />
		<meta name="googlebot" content="" />
		<meta name="msnbot" content="" />
		<meta name="slurp" content="" />
		
		<title>New XHTML + RDFa Document</title>
		
		<!-- Style Resources -->
		<link rel="shortcut icon" type="image/png" href="icon.png" />
		<?php if (is_ie() == 1) { ?>
		
		<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/reset/reset-min.css" />
		<?php } ?>
		
		<!-- JavaScript Resources -->
		<?php if (is_ie() == 1) { ?>
		
		<!--[if lt IE 8]>
		<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" <?=$sic."\n"?>
		<![endif]-->
		
		<?php } ?><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" <?=$sic."\n"?>
		<script type="<?=$js_mine_type?>">
		jQuery.noConflict();
		jQuery(document).ready(function() {
			//...
		});
		</script>
		
	</head>
	
	<body>
		<?php if (is_ie() == 1) { ?>
		<!--[if lt IE 7]>
		<div style='border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;'>
		<div style='position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;'><a href='#' onclick='javascript:this.parentNode.parentNode.style.display="none"; return false;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg' style='border: none;' alt='Close this notice'/></a></div>
		<div style='width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;'>
		<div style='width: 75px; float: left;'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg' alt='Warning!'/></div>
		<div style='width: 275px; float: left; font-family: Arial, sans-serif;'>
		<div style='font-size: 14px; font-weight: bold; margin-top: 12px;'>You are using an outdated browser</div>
		<div style='font-size: 12px; margin-top: 6px; line-height: 12px;'>For a better experience using this site, please upgrade to a modern web browser.</div>
		</div>
		<div style='width: 75px; float: left;'><a href='http://www.firefox.com' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-firefox.jpg' style='border: none;' alt='Get Firefox 3.5'/></a></div>
		<div style='width: 75px; float: left;'><a href='http://www.browserforthebetter.com/download.html' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-ie8.jpg' style='border: none;' alt='Get Internet Explorer 8'/></a></div>
		<div style='width: 73px; float: left;'><a href='http://www.apple.com/safari/download/' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-safari.jpg' style='border: none;' alt='Get Safari 4'/></a></div>
		<div style='float: left;'><a href='http://www.google.com/chrome' target='_blank'><img src='http://www.ie6nomore.com/files/theme/ie6nomore-chrome.jpg' style='border: none;' alt='Get Google Chrome'/></a></div>
		</div>
		</div>
		<![endif]-->
		<?php } ?>

		<h1>XHTML + RDFa!</h1>
		<p property="dc:created" content="YYYY-MM-DD">I am an XHTML document, extended by RDFa. Hello, world!</p>
		<p about="" resource="http://www.w3.org/TR/rdfa-syntax" rel="dct:conformsTo" xmlns:dc="http://purl.org/dc/terms/"><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml-rdfa-blue" alt="Valid XHTML + RDFa" longdesc="http://validator.w3.org/" /></a></p>
		
	</body>
	
</html>

XHTML 2 Col +菜单(简单结构)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>untitled</title>
</head>
<body>
<div class="container">
	<div id="header"></div>
	<div id="menu"></div>
	<div id="sidebar-l"></div>
	<div id="content"></div>
	<div id="footer"></div>
</div>
</body>
</html>

XHTML 非常简单的XHTML模板

/* style.css */

/* ########## STANDARD HTML ELEMENTS ########## */

BODY{
	font-family: Gill sans, verdana, sans-serif;
	font-size: 16px;
	color: #333;
	padding: 5%;
	width: 90%;
	height: 90%;
	}

P{ margin: 0 0 10px 0; }

H1{
	font-size: 2em;
	margin: 0 0 20px 0;
	}
	
H2{
	font-size: 1.5em;
	margin: 0 0 10px 0;
	}
	
H3{
	font-weight: bold;
	margin: 0 0 10px 0;
	}
	
STRONG{ font-weight: bold; }

EM{ font-style:italic }

A:link, A:visited, A:active { font-size: inherit; color: #666699; }
A:hover { color: #669999; }

INPUT.inp, TEXTAREA.inp{
	border: 1px solid #999;
	padding: 4px;
	width: 200px;
	margin: 0 0 10px 0;
	}
	
/* ########## MAIN DIV ELEMENTS ########## */

DIV#wrapper{
	overflow: hidden; /* clear floats */
	}

DIV#header{
	float: left; display:inline;
	width: 100%;
	}
	
DIV#content{
	float: left; display: inline;
	width: 100%;
	}

/* index.php */

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title></title>
	<link rel="stylesheet" href="reset.css" type="text/css" />
	<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
 
	<div id="wrapper">
 
		<div id="header">
 
			<img src="logo.jpg" alt="logo" />
 
		</div><!-- END header -->
 
		<div id="content">
			<h1>Header</h1>
			<p>Lorem ipsum...</p>
		</div><!-- END content -->
 
 	</div><!-- END wrapper -->
 
</body>
</html>

XHTML 显示按词汇表分组的Drupal分类术语

Add the following preprocess function to your theme template.php. If you already have this function, then just add the highlighted line. 

function genesis_custom_preprocess_node(&$vars, $hook) {
  $vars['terms_split'] = genesis_custom_split_terms($vars['node']);
}

// Add the following function to the bottom of your theme template.php
// Split out taxonomy terms by vocabulary
function genesis_custom_split_terms($node) {
  $vocabularies = taxonomy_get_vocabularies();
  foreach($vocabularies as $vocabulary) {
    $terms = taxonomy_node_get_terms_by_vocabulary($node->nid, $vocabulary->vid);
    if ($terms) {
      $links = array();
      foreach ($terms as $term) {
        $links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description)));
      }
      $items[] = '<span class="label">'. $vocabulary->name .'</span>' . '<span class="sep">:</span> '. implode('<span class="glue">,</span> ', $links);
    }
  }
  return theme('item_list', $items, NULL, 'ul');
}

// Finally, in your node.tpl.php add the following line wherever you want the new split terms:

<?php print $split_terms ?>

XHTML XHTML Transitional

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<title>simple document</title>
</head>

<body>
<p>a simple paragraph</p>
</body>
</html>