I was struggling to do some prototyping for a new client. I needed to create a lot of static pages.. and like all static pages, they have a header panel, a side menu panel, footer, and finally the content pane.
Well, if I was to do it in php, the usual method will be something through the use of include files, i.e.
<? require_once(‘header.php’) ?>
<div id=”content”>
Blah blah blah
</div>
<? require_once(‘footer.php’) ?>
This does not really look too ugly, until you look into header.php itself and you see a half rendered webpage that looks really awful in your favourite dreamweaver editor… as the html structure is entirely corrupted in such a partitioning.
A neater way is to use the jQuery approach whereby all you need is:
<? require_once(‘template.php’) ?>
<div id=”content”>
Blah blah blah
</div>
in the main content page. The trick lies in putting the content div into a contentContainer div in the template.php (your template.php must have a contentContainer div to work…) and then hiding the content div.
$(”#contentContainer”).html($(”#content”).html());
$(”#content”).hide();
Now.. doesn’t your PHP codes look like its using the ASP.NET masterpage framework? And the beautiful thing is.. your template.php looks like a perfectly well formatted template in dreamweaver…





