Page 1 of 1

Validation issue

Posted: Thu 19 May 2016 11:57 am
by ConligWX
I am going through all my webpages to check for Validation and i am slightly stuck on one page.

http://www.conligwx.org/wxbuoy.php


the issue i get is this:
Error Line 336, Column 43: document type does not allow element "html" here
<html xmlns="http://www.w3.org/1999/xhtml">

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).
i'm not sure how I fix this within the php files (attached)

if anyone could suggest a solution that would be great.
wxbuoy.zip

Re: Validation issue

Posted: Thu 19 May 2016 4:57 pm
by saratogaWX
Yes, very simple... you need to change

Code: Select all

include("top.php");
############################################################################
?>
</head>
<body>
<?php
############################################################################
include("header.php");
############################################################################
include("menubar.php");
############################################################################
?>

<div id="main-copy">
<h1>UK Buoy Data</h1><br />
  
<?php include("buoy-data.php"); ?>
    
</div><!-- end main-copy -->
to

Code: Select all

include("top.php");
############################################################################

 $doPrintBUOY = false;
 include("buoy-data.php");
 print $BUOY_CSS; 
 ?>
</head>
<body>
<?php
############################################################################
include("header.php");
############################################################################
include("menubar.php");
############################################################################
?>

<div id="main-copy">
<h1>UK Buoy Data</h1><br />
  
<?php
  print $BUOY_MAP;
  print $BUOY_TABLE;
 ?>

    
</div><!-- end main-copy -->
then the correct CSS will be applied, and the buoy-data.php script will no longer insert the extra HTML to make a complete page.

See: http://saratoga-weather.org/scripts-buoy.php#buoydata for more info.

Best regards,
Ken

Re: Validation issue

Posted: Thu 19 May 2016 8:37 pm
by ConligWX
Thanks very much Ken. that worked a treat!

out of all my php pages now I only have one that fails validation.

This is the UK earthquakes. But it is the results coming back from http://www.quakes.bgs.ac.uk/ of which they seem to be adding "&" and not "&" in Town/county names - something of which, I have no control over:)