I was trying to validate a simple HTML5 page, and it successfully validates everything except three instances of <?php include
statements which are marked as errors. I can't figure out what makes it not take the PHP tags. Why would this be? Below are the three errors it outputs:
Validation Output: 3 Errors
Line 29, Column 5: Saw <?. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.)
<?php include("inc/main-menu.php"); ?>
Line 87, Column 9: Saw <?. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.)
2007-<?php echo date("Y"); ?>
Line 94, Column 3: Saw <?. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.)
<?php include_once("inc/analytics.php"); ?>
Those PHP tags should not show up in your markup. They'll be written in your code, but only your web server should see those -the page generated by your server will not have those tags visible.
I'm guessing you are copying your source and pasting into the validator? Try viewing the page in your browser instead (assuming you are running a local web server, like Wamp or Xampp), view source, and then copy and paste that code, instead of directly from your editor.
<?php
is not valid HTML in any dialect. An HTML parser should never see <?php
tags, since they're evaluated on the server. As such, it's correct that the validator complains.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With