View Full Version : Help to improve template script

11-03-2002, 04:58 PM
I've been working too hard today and I can't figure out how to change the value inside the <!-- title --> to $title automatically.

I've tried

$template = eregi_replace("<!-- ".$value." -->", $value, $template)

but that's not doing anything. Here's what I'm using now

$title = "hello";
$bodytext = "test";

$filename = "theme.html";
$fp = fopen($filename,"r");
$template .= fread($fp,filesize($filename));
$template = eregi_replace("<!-- title -->",$title,$template);
$template = eregi_replace("<!-- bodytext -->",$bodytext,$template);

echo $template;

I just want to cut out doing the

$template = eregi_replace("<!-- bodytext -->",$bodytext,$template);

for every single tag in the template.