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 trial
Chris Mitchell
12,719 Pointscreating header and footer php files
Why does the tutor cut the opening div class=content out of the index file??
Also why does he cut the last closing div element out above the start of the footer??
I tried just cutting both the header and footer out without those above mentioned div elements and it still worked fine.... but why??
I am thinking its going to maybe bite me in the behind later on so could do with a heads up on this please thanks
2 Answers
Tom Bedford
15,645 PointsIf every page is going to have the "content" div then it would be less repetition (DRYer code) to have it in the header and footer files. If you wanted to change the class name to something else, or add a new class to the div, you can just change it in the header file and it will be updated for every page.
Chris Mitchell
12,719 PointsI knew there was some logical answer, thanks Tom Bedford!!
I guess though including the last div is a little nit picky but its a good practice thing so I will keep it in mind