Forum Moderators: coopster

Message Too Old, No Replies

<!DOCTYPE html PUBLIC for PHP

Need urgent advice about doctype

         

Autoshipper100

2:21 pm on Jun 25, 2015 (gmt 0)

10+ Year Member



I am looking for advice on the correct doctype for my website <snip> this is a php website but this is at the top of all my pages
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
</html xmlns="http://www.w3.org/1999/xhtml">

Is this the correct doctype to be using for a php website?

[edited by: engine at 1:20 pm (utc) on Jun 26, 2015]
[edit reason] Please see WebmasterWorld TOS [/edit]

whitespace

2:03 pm on Jun 26, 2015 (gmt 0)

10+ Year Member Top Contributors Of The Month



PHP (or how you generate your pages) has nothing to do with it.

If your site really is XHTML then what you have is probably OK (although you have a slash in your opening HTML tag - this is wrong).

However, for any new content you should probably be serving HTML with an HTML5 doctype. Which is simply:


<!DOCTYPE html>

lucy24

6:08 pm on Jun 26, 2015 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have you tried feeding a few random pages into the HTML validator? If the doctype doesn't match the page content, it will yap loudly. A few-- not many-- features of HTML vs. XHTML are mutually exclusive.

A lot of editors (CMS, WYSIWYG) seem to like producing XHTML Strict. There is presumably a boring historical reason for this.