Jump to content


Photo

W3C Validation


  • Please log in to reply
9 replies to this topic

#1 EvoX2004

EvoX2004
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 25 April 2006 - 05:48 PM

ok so I'm very newb at php... i actually learned a little of it by going through this pages that I have to optimize for work and I also have to validate them through the W3C validator. I just need help on why through the validator it gives this error and highlights < in red... "unclosed start-tag requires SHORTTAG YES."

i would greatly appreciate it if anyone knows how to fix this problem...

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 25 April 2006 - 06:09 PM

Are you passin the source code of the php file to teh validator or the output generated by the script?

You should only pass teh latter!
follow me on twitter @PHPsycho

#3 EvoX2004

EvoX2004
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 25 April 2006 - 06:10 PM

no im passing the HTML file through the validator... there is php code in the html file... and so the validator picks up the php and gives me the error on my previous for majority of the php code writtten and meshed in the html code...

#4 aquaman

aquaman
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 25 April 2006 - 06:18 PM

[!--quoteo(post=368561:date=Apr 25 2006, 02:10 PM:name=EvoX)--][div class=\'quotetop\']QUOTE(EvoX @ Apr 25 2006, 02:10 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
there is php code in the html file.
[/quote]

how can there be PHP in the html code that is being generated?

..:: If the solution isn't Linux .. You've got wrong problem ::..

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 25 April 2006 - 06:24 PM

If you have 'unclosed short tag' errors, it means that the html standard against which you are validating does not support the method used in your (html) code for closing tags .... for example <br/>, <img ..../>, <meta ...../> etc. will validate against the right doctype/standard whereas <meta ....> will fail. That should point you in the right direction.
Legend has it that reading the manual never killed anyone.
My site

#6 EvoX2004

EvoX2004
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 26 April 2006 - 02:29 PM

but its not highlighting any HTML code.. its highlighting all the PHP code brackets and the php code is close correctly with <? and then ?> correct?

#7 Yesideez

Yesideez
  • Members
  • PipPipPip
  • Advanced Member
  • 2,334 posts
  • LocationDevon, UK

Posted 26 April 2006 - 02:37 PM

I know its a bit naughty but not all of my sites are W3C compliant but the ones that are, all pages can be checked regardless of whether they're created using PHP or plain HTML.

I've found that the W3C validator will still check and validate code best when its online and not uploaded. That way if the site is written using PHP the result will be HTML and thats whats checked.

If your site has a command line that has to be parsed via the URL then online validators will still parse this and generate the HTML depending on the URL contents.

Plese forgive me for wording this badly if its difficult to read but its extremely hot here at work and I can't open the doors and windows more than they already are :(
Not a pro just an enthusiast :)

if (empty($coffee)) {$coffee=new coffee();}

Please surround any code using the CODE tags - I rarely look at anything without them

#8 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 26 April 2006 - 04:13 PM

[!--quoteo(post=368844:date=Apr 26 2006, 10:29 AM:name=EvoX)--][div class=\'quotetop\']QUOTE(EvoX @ Apr 26 2006, 10:29 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]but its not highlighting any HTML code.. its highlighting all the PHP code brackets and the php code is close correctly with <? and then ?> correct?[/quote]
Are you trying to validate php code using the W3C validator? It will not work. The W3C validator validates html not some mixrure of html and php.
Legend has it that reading the manual never killed anyone.
My site

#9 EvoX2004

EvoX2004
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 April 2006 - 02:21 PM

[!--quoteo(post=368885:date=Apr 26 2006, 11:13 AM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Apr 26 2006, 11:13 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Are you trying to validate php code using the W3C validator? It will not work. The W3C validator validates html not some mixrure of html and php.
[/quote]



ok... so is there a way to validate both at the same time? or its not possible at all?

#10 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 27 April 2006 - 03:26 PM

The W3C Validator only validates HTML and CSS. You cannot validate your PHP code as there is no set standard to PHP. However HTML and CSS do the people that set the standards are W3C.

Why are you trying to validate your PHP?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users