okay okay i get it.. my bad..
you have a template with certain tags in it and those need to be replaced by values?!
this is the way i do it.. i have a template with html comment in it..
<html>
<title><!--title--></title>
<body>
<h1><!--header--></h1>
<hr> <!--content--> </hr>
<b><!--footer--></b>
</body>
</html>
the array with values:
$TEMPLATE[title] = "mytitle";
$TEMPLATE[header] = "this is the page header";
$TEMPLATE[content] = "this is the content of the page";
$TEMPLATE[footer] = "tjsah";
now the parsing:
$thewebsite contains the template data (return the file to that var)
// fetch all template variables
preg_match_all("#<!--(.*)-->#Uis", $thewebsite, $arr);
// if items are more than one time used.. parse them once
$arr[0] = array_unique($arr[0]);
// loop through the list..
foreach ($arr[0] as $val) {
// strip the comment tags
$templateval = eregi_replace("[(<!--)|(-->)]",null,$key);
// replace the data
$thewebsite = eregi_replace($val,
$TEMPLATE[$templateval], $thewebsite);
}
// print without further comment in the html code
echo eregi_replace("<!--[>]*-->",null,$thewebsite);
hope this helps.. btw.. there may be some coding errors in here.. because its written without testing..