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 Basic PHP Website Building a Media Library in PHP Including the Header

Wouldn't leaving the closing div tag cause every text editor to yell at you since it doesn't have its opening tag?

Wouldn't leaving the closing div tag cause every text editor to yell at you since it doesn't have its opening tag?

She cut out down to the context div and moved it to the header file. I get this, but leaving just a closing tag will cause an issue will it not?

Kristoff Villanueva
Kristoff Villanueva
898 Points

I also wanted to ask the same. Although the code still works, this needed to be explained why we left the closing tag out.

A simple text editor/IDE may yell at you, yes. But, once the code within <?php include("inc/header.php"); ?> is parsed and loaded by the browser along with the html below it, and the browser interprets all the html as being together again.

That being said, I use VS Code for building custom php themes and this IDE is smart enough to not yell at me for having opening/closing tags in different files. I can't recall if that's a php linter plugin or if VS Code is just smart enough to know what's going on, but it doesn't yell at me for it either way. The most important thing for me is leaving comments on these tags so I know what file the other half is hiding in, ie. </div><!-- .body-container Note: starts in header.php -->