How do i print loop in a html file. You can see in the following code
that I have to repeat $row[food] and $row[user_photo],$row[user_name] in the same html file.
Please help me..
<?php
//photo.php file
require_once("template.php");
global $db;
$id=intval($_GET["id"]);
$row["title"]="This is page title":
$row["location"]="UK";
$row["food"]=array("Asian","European","Middle East");
$result=@mysql_query("SELECT user_name,user_photo FROM user where user_id='$id'",$db);
$row["found"]=@mysql_num_rows($result);
$row=@mysql_fetch_array($result);
template($row,"photo.html");
?>
<?php
//template.php file
function template($row="",$tpl="") {
$tmpfile="$tpl";
if(!file_exists($tmpfile)){
die("File '$tmpfile' Not Found.");
}
$file=implode("",@file($tmpfile));
$file=addslashes($file);
eval("\$output=\"$file\";");
$output=stripslashes($output);
echo"$output";
}
?>
//photo.html
<html>
<head>
<title>
$row[title]
</title>
</head>
<body>
<table border="0" width="100%">
<tr><td colspan="2">Found $row[found] photos , location $row[location]</td></tr>
<tr><td>User Name</td><td>User Photo</td></tr>
<loop>
<tr><td>$row[user_name]</td><td>$row[user_photo</td></tr>
</loop>
</table>
<table border="0" width="100%">
<tr><td>Favourite Foods</td></tr>
<loop>
<tr><td>$row[foods</td></tr>
</loop>
</table>
<body>
</html>