advantages of splitting up layout into header, page, footer
-
I was taught to put the header stuff into header.php, the footer stuff into footer.php, and so on. But it hit me today that I don’t know why it is advantageous to split things up that way. I’m happy to load the style sheet in header.php, but is there some reason why I should keep my banner div in header.php and not move it into page.php? And similarly with the footer stuff? The advantage of having everything in one place (page.php) would be: eliminate mistakes about closing the wrapper div. If you’ve got one </div> too many, you end up closing the wrapper div prematurely, often without realizing it.
I’m fine with keeping the sidebar code in sidebar.php. I like the idea of putting the logic of whether to use the sidebar in page.php, and putting the actual sidebar code into sidebar.php.
- The topic ‘advantages of splitting up layout into header, page, footer’ is closed to new replies.