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!
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
Why have an opening div tag at the bottom of header.php?
When we copy and paste the header from index.php to header.php why are we copying this opening div tag
It feels more intuitive to leave this out because when I or someone else is working on index.php it may not be immediately apparent that the opening div tag at the top is actually at the bottom of our header.php.
Is this just an accepted best practice? If so then fair enough! Just seams weird to me.
<i>Sorry Michael, I always post my answers in the wrong spot... talk about being sloppy...</i>
Honestly, not sure why he did it that way, but it really doesn't matter when using php include(). This is since the include(), if coded properly, would seamlessly fit into the flow of the HTML document.
I think your intuition is correct... this can easily cause confusion! Personally, I think it would be best to have that at the TOP of the code so when I saw it, I would know exactly where I was.
My code is often sloppy (a lot of testing and "commenting out stuff") so when it comes to inserting php code I make sure that there aren't any "danglers." As he showed in one of the videos, a SIMPLE mistake in php code context and everything goes awry!
Keep up the good work!!!