Forum Moderators: coopster
<!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" xml:lang="en" lang="en">
regards
That's declaring that you're outputting an XHTML file. OK if that's what you're doing. But if it's straight HTML you're outputting go with something easy like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Whether it's in your HTML or output from php, make sure it's the first thing at the top of your file/output and there only once.
Lastly, I always validate my php just like I would any normal HTML, but I do take validator recommendations with a grain of salt. Serious errors I fix, warnings like - need an alt tag or table summary, I may not fix.
My 2 cents,
Burner
Whether or not you validate has nothing to do with whether the (X)HTML is being generated by PHP, Perl, ruby or C, but whether or not you want to ensure that what is being sent to the browser is valid.
As Tedster is always arguing in the HTML forum, more important than xhtml/html distinction is the strict/transitional distinction. Better to validate to *some* strict DTD than to any transitional one if possible (and sometimes it isn't if you have, say a CMS that allows people to post HTML).
Make sense?
As Tedster is always arguing in the HTML forum, more important than xhtml/html distinction is the strict/transitional distinction. Better to validate to *some* strict DTD than to any transitional one if possible (and sometimes it isn't if you have, say a CMS that allows people to post HTML).Make sense?
I'd admit in a heartbeat that my HTML is weak. It's not what I do so I haven't followed that forum or any issues there. In most of my projects, I have my php code separated from HTML so a web guy can do his thing on the templates and I do mine. I am intrigued by what you're saying though. When working with HTML, I've always set all my output to transitional assuming that that was the looser guideline. I shouldn't be normally be using that declaration? Furthermore, could I be creating any negative SEO issues with this?
Any insight you have or pertinent discussions you could forward me to would be appreciated!
Burner
The problem is just that, when you allow transitional, you allow deprecated features or coding practices that the strict DTD would not allow. Many of these make parsing and rendering harder and increase the number of page elements where the means to handle them is left up to the browser, so the chance for problems is higher and the ability to locate them is lower (because it will pass the looser test because of, perhaps, something that you did not intend to do, but which will be allowed by the looser definition).
Remember the maxim: Be strict in what you output, liberal in what you accept.
In other words, if you're designing a browser, you want it to try to recover from bad or imprecise HTML, to tolerate deprecated features and to do its best with what it's got. If you're designing a web page, though, you don't want it to test the browser's support for deprecated or non-standard features.
only thing that my pages won't validate when i switch to strict dtd is "target=_blank", i know i can use javascript to achieve the same effect, and switch all my pages to strict dtd. but what if user disable the js in their browser? that's why, i would say going for strict dtd as a standard will be a long haul.
what about backward compatiability with browers? do you develop different versions of your webpage for older browers to achieve some or all of the effects you put on the page? or you just let it render in quirks mode.
I have to say, that was also the last one that I wanted to give up, but when you look at the logic of it, the target attribute should only be used with frames, as it was intended.
Opening a new window is a client-side activity. Users who have javascript turned off have it off because they do not want the website messing with client behavior. By using this one deprecated feature, you are disrespecting your user's wishes. Using target="_blank" is just a popup in disguise and users with JS off frequently do so specifically to block popups.
So in sum
- users with JS on don't really see a difference
- users with JS off are just getting upset and there's no percentage in that.