better yet - create an associative array of variables to use as data to fill your template (this can come from the database).
then do something like this to pull in all the data:
$text = preg_replace ('/\{([^}]+)\}/e', 'doReplace(\'\\1\');', $text;
// where the func looks like this:
function doReplace ($repVarName)
{
global $repVars;
if (isset ($repVars[$repVarName])
{
return $repVars[$repVarName];
}
else
{
return '';
}
}
.. then once youve got that going, you can get really funky and start merging in sub-templates and setting up your own control structures 😉