10 Nov 2000 matman   » (Observer)

Mazeone: The best way to build pages using templates, while still giving you a lot of flexability (that I've been able to come up with so far) is using an object oriented template.

for example...
class pageTemplate() {
function useTemplate($path)
This function loads a template

function registerKey($key, $value)
This function sets an array $array[$key] = $value

function renderPage()
This basically does an echo $this-returnPage();
exit;

function returnPage()
This function replaces all instances of each
key in the array with their respective values
and returns the composite

function renderError($errorCode)
Builds an error reporting page and prints the
$errorCode

So, it's pretty simple really. You can even use this to build menus from menu templates, and then plug that content into your page template.

The examples are in pseudo php btw. :) If you want further examples, you can email me (johnston@megaepic.com)

By the way, sorry for the non-indenting. I'm not sure how to tab stuff in on here. Ideas?

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!