PHP Build a Basic PHP Website (2018) Building a Media Library in PHP Including the Header

Rasbin Rijal
Rasbin Rijal
Pro Student 10,863 Points

[ SOLVED ]Including a header file

In the video shown, When moving the header files from index.php to header.php, the opening div of content is also copied in last line. Why should we copy the opening div at last line? Is it the strict rule?

<div class = "content">

2 Answers

If your going to have all of your content wrapped in a DIV on every page, than it's saving you two lines of code per page; " div id='content' " and the closing tag. I think the div in the header is irrelevant to what they are teaching you, the purpose of that particular video/tutorial is to show you how to include a header (and other .php pages) into your website.

You'll quickly learn that when you code a few websites, that every website is different, code format will very rarely be the same as the last.

Its not a strict rule though it helps when you have multiple content pages so that you don't forget to add the content containers div to one of your pages.