Web Hosting Talk







View Full Version : problem with html validation errors


bambinou
04-03-2010, 04:31 PM
Hi,

I am kind of "screwed" right now, my programmers are off and I would like to clean up some code on our my site, I have just done a validator.w3.org check and the front page comes up with over 350 errors, now the first error at the top is:

Warning No DOCTYPE found! Checking with default XHTML 1.0 Transitional Document Type.

No DOCTYPE Declaration could be found or recognized in this document. This generally means that the document is not declaring its Document Type at the top. It can also mean that the DOCTYPE declaration contains a spelling error, or that it is not using the correct syntax.

The document was checked using a default "fallback" Document Type Definition that closely resembles “XHTML 1.0 Transitional”.


My site has:
<html xmlns="http://www.w3.org/1999/xhtml">


Why this error comes up? any idea please? If I send you my website URL could you please have a quick look and tell me which doctype I should add instead of the one above?


Thank you,


BamBam

PCS-Chris
04-03-2010, 05:43 PM
That's not a full doctype

Take a look at the examples here: http://www.w3.org/QA/2002/04/valid-dtd-list.html

bambinou
04-03-2010, 05:48 PM
Thanks PCS-Chris,

I went to your page but really, so many doc types out there I haven't got a clue on how to choose the right one.

PCS-Chris
04-03-2010, 05:52 PM
Based on the comments from the validator I would suggest trying:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

350 is an awful lot of validation errors though. Good luck working through them :)

bambinou
04-03-2010, 06:47 PM
Thanks for your help,

In my site I have 3 php headers, on the index page your doctype works fine, but when I add it to the other 2 headersm the layout breaks up, all my tables are all over the place, any idea why?


Thank you,


BamBam

phunknCREATIVE
04-03-2010, 07:02 PM
Even placing a doctype in a website with no doctype might remove quite a lot of those errors.

If you want the really easy way out, try:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

I recommend sticking to XHTML and ironing the errors out though =)

cpoalmighty
04-03-2010, 09:07 PM
If its php you are using, you only need to add the doc type to the header php and then it should be incorporated into the other site. (once the code is done correctly) Is this a custom cms you are using?

bambinou
04-04-2010, 06:14 AM
Hi,


Actually I have different headers in my site because it has different parts that have been added by different people over a 3 years period.

By adding the header above it does not remove any errors at all, it stay the same, but on the header number 2, the tables are showing all over the place when I add this doc type, do doctype change something in the code itself? the way the tables are showing maybe?


Thanks,


BamBam