agbates Posted January 4, 2008 Share Posted January 4, 2008 Hello Everyone, I'm not skilled with php. I am currently working on an xhtml project which uses the following php: http://www.alistapart.com/articles/keepingcurrent/ When running it thru the W3 validator for XHTML strict, it comes up with errors regarding the use of "short tags". Can anyone supply a compliant workaround? The original author of the article is long gone somewhere.. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/84482-xhtml-validation-problem-with-shorttags/ Share on other sites More sharing options...
GingerRobot Posted January 4, 2008 Share Posted January 4, 2008 When i run that page through the validator, there are 6 errors shown for me, all of which relate to input fields missing a containing element. Quote Link to comment https://forums.phpfreaks.com/topic/84482-xhtml-validation-problem-with-shorttags/#findComment-430424 Share on other sites More sharing options...
agbates Posted January 4, 2008 Author Share Posted January 4, 2008 Here's the code I attempted to validate using the W3 validator, XHTML strict doctype: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <?php $thisPage="All about us"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>XHTML Strict Navigation Test</title> <style type="text/css" media="screen">@import"styles/site.css";</style></head> <body> <div id="navigation"> <ul> <li<?php if ($thisPage=="Page One") echo " id=\"currentpage\""; ?>> <a href="http://www.nowhere.com/pageone.php">Page One</a></li> <li<?php if ($thisPage=="Page Two") echo " id=\"currentpage\""; ?>> <a href="http://www.nowhere.com/pagetwo.php">Page Two</a></li> <li<?php if ($thisPage=="Page Three") echo " id=\"currentpage\""; ?>> <a href="http://www.nowhere.com/pagethree.php">Page Three</a></li> <li<?php if ($thisPage=="Page Four") echo " id=\"currentpage\""; ?>> <a href="http://www.nowhere.com/pagefour.php">Page Four</a></li> </ul> </div> </body> </html> Here are the results reported by the validator: Validation Output: 17 Errors 1. Error XML Parsing Error * Line 12, column 7: XML Parsing Error: error parsing attribute name <li<?php if ($thisPage=="Page One") * Line 12, column 7: XML Parsing Error: attributes construct error <li<?php if ($thisPage=="Page One") * Line 12, column 7: XML Parsing Error: Couldn't find end of Start Tag li line 12 <li<?php if ($thisPage=="Page One") * Line 14, column 68: XML Parsing Error: Opening and ending tag mismatch: ul line 11 and li …://www.nowhere.com/pageone.php">Page One</a></li> * Line 15, column 7: XML Parsing Error: error parsing attribute name <li<?php if ($thisPage=="Page Two") * Line 15, column 7: XML Parsing Error: attributes construct error <li<?php if ($thisPage=="Page Two") * Line 15, column 7: XML Parsing Error: Couldn't find end of Start Tag li line 15 <li<?php if ($thisPage=="Page Two") * Line 17, column 68: XML Parsing Error: Opening and ending tag mismatch: div line 10 and li …://www.nowhere.com/pagetwo.php">Page Two</a></li> * Line 18, column 7: XML Parsing Error: error parsing attribute name <li<?php if ($thisPage=="Page Three") * Line 18, column 7: XML Parsing Error: attributes construct error <li<?php if ($thisPage=="Page Three") * Line 18, column 7: XML Parsing Error: Couldn't find end of Start Tag li line 18 <li<?php if ($thisPage=="Page Three") * Line 20, column 72: XML Parsing Error: Opening and ending tag mismatch: body line 8 and li …owhere.com/pagethree.php">Page Three</a></li> * Line 21, column 7: XML Parsing Error: error parsing attribute name <li<?php if ($thisPage=="Page Four") * Line 21, column 7: XML Parsing Error: attributes construct error <li<?php if ($thisPage=="Page Four") * Line 21, column 7: XML Parsing Error: Couldn't find end of Start Tag li line 21 <li<?php if ($thisPage=="Page Four") * Line 23, column 70: XML Parsing Error: Opening and ending tag mismatch: html line 3 and li …ww.nowhere.com/pagefour.php">Page Four</a></li> * Line 24, column 2: XML Parsing Error: Extra content at the end of the document </ul> 2. Warning unclosed start-tag requires SHORTTAG YES The construct <foo<bar> is valid in HTML (it is an example of the rather obscure “Shorttags” feature) but its use is not recommended. In most cases, this is a typo that you will want to fix. If you really want to use shorttags, be aware that they are not well implemented by browsers. * Line 12, column 7: unclosed start-tag requires SHORTTAG YES <li<?php if ($thisPage=="Page One") * Line 15, column 7: unclosed start-tag requires SHORTTAG YES <li<?php if ($thisPage=="Page Two") * Line 18, column 7: unclosed start-tag requires SHORTTAG YES <li<?php if ($thisPage=="Page Three") * Line 21, column 7: unclosed start-tag requires SHORTTAG YES <li<?php if ($thisPage=="Page Four") I hope that helps? Quote Link to comment https://forums.phpfreaks.com/topic/84482-xhtml-validation-problem-with-shorttags/#findComment-430480 Share on other sites More sharing options...
revraz Posted January 4, 2008 Share Posted January 4, 2008 It doesn't understand that you are putting PHP inside your list tag, so it thinks it isnt closed. Quote Link to comment https://forums.phpfreaks.com/topic/84482-xhtml-validation-problem-with-shorttags/#findComment-430483 Share on other sites More sharing options...
GingerRobot Posted January 4, 2008 Share Posted January 4, 2008 In other words, you're supposed to validate the output (i.e. the HTML) not the PHP. Quote Link to comment https://forums.phpfreaks.com/topic/84482-xhtml-validation-problem-with-shorttags/#findComment-430490 Share on other sites More sharing options...
agbates Posted January 4, 2008 Author Share Posted January 4, 2008 Ohhh, I understand..the validator validates html and not php code (don't ask me why I thought that ) the validator is looking for something and when it doesn't find it, it cries foul. gotcha. Quote Link to comment https://forums.phpfreaks.com/topic/84482-xhtml-validation-problem-with-shorttags/#findComment-430540 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.