Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy. This forum is not for asking programming related questions.
Just wanted to check and see if someone can point to a good resource on the internet that explains which doctype to use if you have used html in php with these kinds of tags:
I would go for a strict doctype. Whether it's html or xhtml doesn't really matter. Well, ok maybe html 4 strict is a better choice. But that will depend on many factors.
It's quite a discussion though. At first everyone following the webstandards movement switched to xhtml. Proudly showing buttons xhtml/css. But lately many people have returned to html strict, realising that serving xhtml as text/html is kind of silly. Personally I'm used to xhtml strict, so that's a bit easier for me. But html 4 strict is just as fine for me.
Since you're not building it from the ground up, I'd take small steps and start by making your docs HTML 4.01 Transitional compliant.
Your real question, however, about double-quotes and single-quotes, no the doctype doesn't matter. Single quotes are always valid, although personally I prefer using double-quotes (if you've got lots of inline HTML in your PHP, that's something else that you probably should fix by moving it to templates).
HTMLTidy is your friend. If you use jEdit, its got a tidy plugin built-in to format your html according to the specified DTD. (jEdit is awsome btw, highly recommended).
Another thing you might wanna try is not having php output any html at all. Instead, have the document all html and insert inline PHP tags where necessary. If you do need php to generate html, make sure it is generating both the opening tag and the ending tag. o One, to eliminate confusion, and two, so that a formatter or checker can still validate even though there is PHP involved.
Personally, I would write xhtml strict. It will allow the most consistent rendering of your website between browsers.
Personally, I would write xhtml strict. It will allow the most consistent rendering of your website between browsers
I don't think this is true. But if you can convince me otherwise, you're welcome to do of course.
It's even the case that if you serve real XHTML as application/xhtml+xml, you'll encounter many problems trying to even getting your pages rendered at all. One small mistake and you get nothing but a yellow screen of death. Some browsers don't support xhtml at all (IE). well read all about it here.
I like to use strict. Either HTML or XHTML strict, but always strict. And I never use single quotes when wrapping HTML tag elements. And... oh never mind, I pretty much answered the original question.
thanks guys for the replies with help/suggestions/tips/and recommendations!!
Thank god (and also to Ambush Commander for letting me know that single quotes will not be an issue) I dont have to go through lines and lines of code to change it back to double quotes...
As far as strict/loose go: I am going to go with HTML strict. Have read up on the differences (thanks to matthijs in the first reply with the links to read-up on )
@bg: thanks, I will def. take a look at those editors. I am getting kind of bored with word pad anyways.... might as well switch to something that will help along the way too.
@Everah: "And I never use single quotes when wrapping HTML tag elements" I know... should have followed this BEFORE... I guess I learned the hard way, huh?
But, I am sure i wont make this mistake twice.... (wrapping HTML tag elements with single quotes)