The
Palm
Civet

Posts tagged php

simple php templating system

when a request comes along to build a static website with multiple pages and no cms, i find php includes to be the simplest solution. an example page can look something like this =>


<?php include $_SERVER['DOCUMENT_ROOT'] . '/_forms/header.php' ?>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/_forms/nav.php' ?>
<div id="content">
...
</div>
<div id="sidebar">
...
</div>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/_forms/footer.php' ?>

that way you can nest reusable chunks of code into a folder of template forms.

compiling and sharing code, ideas, and tools for making better websites and applications.

by justin talbott {email me}

what is a palm civet?