Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBoris Vukobrat
4,248 PointsDOCTYPE in php
Shouldn't we use <!doctype ...> tag as in static pages? Client renders html code in both cases.
2 Answers
Kris Phelps
7,609 PointsHey Boris,
Best practices says we should. I'm thinking Randy omitted it simply because browsers are forgiving and can render the HTML without a DTD declaration, and he was probably just trying to whip up a project for us quickly.
Because HTML5 doesn't really use a DTD, the doctype isn't as useful as it used to be with html4, but that's because html4 had tons of varieties like html strict, html transitional, xhtml transitional, xhtml strict and so forth. This doesn't mean it is optional, it is absolutely required. Like I said, I think Randy was just being loose with his coding when he made the project.
HTML5 doesn't require a DTD, therefore, he have the really nice doctype of <!doctype html>
. Luckily, because we have the header.php file, it's quite easy to deploy it sitewide :-D
John Sanchez
3,325 PointsYes, I noticed this too. I included it and I am not sure why Randy did not.
Boris Vukobrat
4,248 PointsBoris Vukobrat
4,248 PointsI guess that's why Randy smiles all the time : ))
Kris Phelps
7,609 PointsKris Phelps
7,609 PointsProbably, LOL. He seems like a really nice guy.