to all guru
has any one here worked on template base programming??
I do have a problem in my template base programming
i do have this file called "template.tpl"
here is the HTML code
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="200" border="1">
<!--START HERE -->
<tr>
<td>{member.NAME}</td>
</tr>
<!-- END HERE -->
</table>
</body>
</html>
and i do have script called generate.php
<?
mysql_connect("localhost","","");
mysql_select_db("testdb");
$filename='template.tpl';
if($handle = fopen($filename, "r")){
$template_content = fread($handle, filesize($filename));
fclose($handle);
}
$query=mysql_query("select * from members");
while ($result=mysql_fetch_object($query))
{
$name=$result->name;
// do some replacement here using str_replace or eregi
}
?>
As of now I am stuck in this code
Questions:
how can i replace the {member.NAME} with $name
i used str_replace but it only replace the last result. The result should be in listing not only one
I used this kind so that the script will be adoptable to other templates