I am trying to use a separate php file to make a header, which will be common to all my pages. Although it is working, when I try to validate my [PHPNET]index.php[/PHPNET] page I am getting an error saying:
Line 96, Column 70: document type does not allow element "html" here <html>
The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).
One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
Line 169, Column 8: end tag for "head" which is not finished </head>
Most likely, you nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>
Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, in HTML the <head> element must contain a <title> child element, lists require appropriate list items (<ul> and <ol> require <li>; <dl> requires <dt> and <dd>), and so on.
My files are contructed in this way (simplified to give an explanation):
index.php File Code
<link rel="stylesheet" type="text/css" href="URL address" />
Header.php File Code
css header code…….
Html header code…..
Template.css File Code
Other css code included here related to index.php …….
I tried different ways but I am not finding a solution. I wish to clear up these validation errors but at the same time using a common php header to facilitate website updates.
Thank you in advance for your help.
Much appreciated !