-1

I recently changed all of my website pages to php in order to add a menu that I don't have to update on every single page. Now, however, when I try to validate my pages with the w3c validator, I receive irrelevant errors such as 'stray start body tag' and the like. To convert to php, I changed the extension from html to php and put bits of php code where I wanted the menu (inside of the php tags of course). I think that the validator should still be able to validate my html now. What is going on? Thank you!

Sparky
  • 98,165
  • 25
  • 199
  • 285
aquarist
  • 9
  • 4
  • Could you show us a code snippet where the error occurs ? – Zaffy May 04 '14 at 15:32
  • Here is the w3 validation. [link](http://validator.w3.org/check?uri=http%3A%2F%2Faquariumkids.com%2F&charset=%28detect+automatically%29&doctype=Inline&ss=1&group=0&user-agent=W3C_Validator%2F1.3+http%3A%2F%2Fvalidator.w3.org%2Fservices). Is that what you wanted? – aquarist May 04 '14 at 15:34
  • You should really look at your source code from the browser. Maybe something has changed. – iamsleepy May 04 '14 at 15:35
  • 2
    You should include sufficient code (HTML code in this case) in the *question itself*. Questions should be understandable and analyzable as standalone, even if all links stopped working. – Jukka K. Korpela May 04 '14 at 15:36
  • @JukkaK.Korpela he did. See his comment. – Zaffy May 04 '14 at 15:38
  • I just downloaded the files from the server and they all look okay to me. – aquarist May 04 '14 at 15:46
  • I have never seen the W3C Validation service incorrectly report a fully compliant page as non-compliant. Your page contains one or more errors possibly causing other errors to be reported, _but it contains errors nonetheless_. Post the markup in your OP (not in comments) so we can see, otherwise, your question is useful to nobody. – Sparky May 04 '14 at 16:10
  • Also, you incorrectly used the [tag:validation] tag, which is meant for "data validation (form inputs)", not validation of markup for standards compliance. – Sparky May 04 '14 at 16:12
  • @Zaffy: Where? The OP [posted](http://stackoverflow.com/questions/23457999/irrelevant-errors-from-the-w3c-validator-after-a-change-to-php#comment35960755_23457999) only a link. When OP’s pages goes 404 or when OP changes the HTML according to advice from our answers, this question is of no use to anyone else anymore. – unor May 04 '14 at 18:02
  • @unor I agree with you. – Zaffy May 04 '14 at 18:21

2 Answers2

0

Those errors are right. Let's take a closer look on the first one:

Error Line 112, Column 15: Stray doctype.

<!DOCTYPE HTML>

This means that doctype was found somewhere where he shouldn't be.
In your example it's on the line 112:

function askfirstdisqus(){ 
</script>
<!DOCTYPE HTML> <-- Line 112
<html>
<head>

Just scroll down and in the source find the reported line and you'll see the problem.
You're probably using php's include to include some files and you end up with multiple meta datas.

Community
  • 1
  • 1
Zaffy
  • 16,801
  • 8
  • 50
  • 77
  • Thank you! That's exactly the problem. My menu.php file had all of the doctypes and other tags in it. Sorry, I can't upvote you yet, as I need 15 rep – aquarist May 04 '14 at 15:55
  • @aquarist, you cannot vote, but you can "accept" this as the correct answer by clicking the checkmark. Also, please fix your OP so that it contains the relevant code or error messages. As it stands [the link you posted](http://validator.w3.org/check?uri=http%3A%2F%2Faquariumkids.com%2F&charset=%28detect+automatically%29&doctype=Inline&ss=1&group=0&user-agent=W3C_Validator%2F1.3+http%3A%2F%2Fvalidator.w3.org%2Fservices) will soon be out of date as it will no longer report any errors. – Sparky May 04 '14 at 16:17
0

Make sure the stray tags are only opened once. You usually see this error when embedding or including pages with full markup.

Example

Standard

<!DOCTYPE HTML>
<html>
  <body>
    <head>
    </head>
  </body>
</html>

However, you have a new DOCTYPE, body, etc tags (the stray tags) within the original, like so:

<!DOCTYPE HTML>
<html>
  <body>
    <head>
    </head>
    ....
    <!DOCTYPE HTML>
    <html>
      <body class="new_DOC">
      </body>
    </html>
    ....
  </body>
</html>
JBC
  • 112
  • 5