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

PHP Build a Simple PHP Application Creating the Menu and Footer Including the Header

Ryan Hellerud
Ryan Hellerud
3,635 Points

Confused about something about this video

My question is why does he cut the div class= content from the page and include that in the header file and then, he does not end up closing that div in the contact page after he includes it. Just wondering about this seeming discrepancy.

Ryan Hellerud
Ryan Hellerud
3,635 Points

I just realized he doesn't close the html or body tag either... is that standard practice?

1 Answer

Erik McClintock
Erik McClintock
45,783 Points

Ryan,

He adds the opening tag for that div in the header file because in PHP you can include your header and footer files easily in individual pages, allowing your code to be more DRY. The closing tag for that div will come in the footer file. Thus, any individual page on the site that you include the header and footer on (which should be every page) will automatically have all of its contents wrapped in that "content" div!

Erik

Erik McClintock
Erik McClintock
45,783 Points

The html and body tags will also be closed in the footer file.

Ryan Hellerud
Ryan Hellerud
3,635 Points

I got ya, it was confusing because in the video he didn't include the footer at first so there was just that opening div but I get it thanks!