[thelist] Templating solutions?

Peter peter at poorbuthappy.com
Sun Dec 30 05:29:42 CST 2001


>What does one do when the templates of most pages within one site differ 
>in look
>and feel? One possibility would be to specify a template, load it into a
>variable and replace certain marked spots (a la "<!--left_navbar-->") with the
>dynamically created code/text using eregi_replace() or something similar.
>
>What are the templating solutions available? Pros and cons?

You want to use something like FastTemplates (available for several 
languages). What it does (and others similar to it) is to remove ALL coding 
from the HTML. So your templates look something like

<html>
<head>
<title>{DOCTITLE}</title>
</head>
<body>
<h1>{PAGETITLE}</h1>

where doctitile and pagetitle are just a few of the variables you create in 
your code. If you use this, you could even edit your templates with 
dreamweaver, and they'd still work. Very powerful. Then, the code for each 
page could be something like: (if you're using PHP)

<?
include ("../../main_includes.php");
$page = 85;
$template = "funkytemplate.tpl";
$cachetime = 500;
generate_template($page, $template, $cachetime)
?>

All the magic happens in main_includes.php ofcourse.

Very flexible way of coding. Good luck.
Peter





More information about the thelist mailing list