Andrick Borderguard & Ketchup Co.
code.junkie: php require header and footer
 [ Zen and the Art of the Dynamic Header & Footer ]

Harking back to my complete lack of desire to do busy work, this is one of my favorite tools. I love the idea of the dynamic 'header' and 'footer'; almost all the sites I build these days are contained this way.

Part of that, I suspect, is my recent escape from Mediocre Content Management System & the Loudmouth Who Coded the Parts He Didn't Steal Hell. And part of it is that the restrictions of a full CMS -- particularly a homegrown one -- can be, well, chafing to a designer. It can end up involving cream and stuff. At its' worst, it can lead to Prozac, loud ranting around the studio, or the liberal application of beer.

But the other part of it is that I do like the idea of changing things exactly once. This makes for a nice balance.

Basically, by creating your pages as .php, you can then invoke the requirement statement and fill it with all that dreck you need to build a coherent page. Your code ends up looking like this:

<!DOCTYPE>
<html>
<?php require("inc/page_top.php"); ?>


My content goes here. And only my content.

<?php require("inc/page_bottom.php"); ?>
</html>


The true beauty of using the require is that what's in it doesn't have to be encapsulated inside PHP -- but that PHP can be encapsulated inside it. You can throw the entire header south of the DOCTYPE in plain HTML if you so desire -- and I often do -- and then pick up or incorporate small scripts to change titles, includes and metas. Google Analytics, site tags and the like end up in the footer. And it's not a heavy load on the server like Server Side Includes [see, I am old] used to be and CMS' often are.

And yes, this has been evangelized a thousand places. I just don't know that it's evangelized enough, or in quite this fashion.

All this is not to crack on excellent projects like Joomla, or even proprietary 'ware like Vignette, ColdFusion or WebObjects -- which I've worked in before and will work with again. They absolutely have their uses, particularly in enterprise rollouts.

But a thinly disguised chance to crack on a certain content management system and the incompetent ego with legs that 'designed' it while he ruined a company in the process and then bailed? Could be...
Home About: T.E.D. Andrick About: Our Philosphy About: The Name Portfolio: Web Design Portfolio: Template Design Portfolio: Identity Design Portfolio: Print Design Clients/Projects: Client List Clients/Projects: Projects List Clients/Projects: Special Projects More: Filter.Junkie Thin Chrome Gold Text Infamous MacOS 'Gel' Buttons More: Code.Junkie YoungPup's dropdown menus The IE6 PNG display hack A really simple JavaScript image button rollover A not-simple CSS image button rollover Sliding DIVs Fading DIVs The IE/ActiveX Control hack Flash and JavaScript variables Flash & XML text marquee The gerenic emailer The beauty of the dynamic header & footer The generic picture viewer More: Links Contact: Employment Contact: Analog Space