|
|
A solution to this problem is to use the require function of the PHP system.
(I'm new at PHP, just learnt it yesterday, please feel free to correct anything
Here are some examples of pre-body text:
Normal XHTML document pre-body information:
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>[/b]
<head>
<title>My XHTML Site</title>
<link rel="stylesheet" href="allpages.css" type="text/css" />
<style type="text/css">
...style information here...
</style>
</head>
Normal HTML 4.01 document pre-body information:
<html>
<head>
<title>My HTML Site</title>
<link rel="stylesheet" href="allpages.css" type="text/css" />
<style type="text/css">
...style information here...
</style>
</head>
Note: there are also many doctypes for HTML and XHTML, these are just some examples. There is also HTML 3.2 and 2.0 instead of 4.01.
PHP document:
<head>
<title>My PHP Site</title>
</head>
Here is the one you should be using for PHP/XHTML pages:
<head>
<title>Achoo!</title>
<link rel="stylesheet" href="allpages.css" type="text/css" />
<style type="text/css">
...style information here...
</style>
</head>
The doctype.php file:
$xml="<?xml version='1.0' encoding='iso-8859-1'?>";
$doctype="<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>";
$html="<html xmlns='http://www.w3.org/1999/xhtml'>";
echo $xml . " " . $doctype . " " . $html;
?>
In this case, the browser still outputs the XML encoding, the DOCTYPE declaration and the HTML document declaration. If you view the source of the page, you can't tell that it used the PHP (remember, PHP is server-side).
I hope this has helped you create more valid pages for your website. Please remember, we are cleaning up the web here, so make sure your documents have valid XHTML/CSS and no broken links.

