Hello,
I m tring to make my own simple template. As I am not familiar with oop i decided to use a simple function.
The following code works fine when i have single record.
$row= is the all records loaded from database or defined.
$tmlt=is the name of html file
let say I have a template call profile.html
and it has the following code
//profile.html
User Name:$row[user_name]
User Phone:$row[user_phone]
User photo:// how to display loop here
<?php
$result=@mysql_query("SELECT * From user",$db);
$row=mysql_fetch_array($result);
$result2=@mysql_query("SELECT * FROM photo where user_id='$row[user_id]'",$db);
$loop=@mysql_fetch_array($result2);
template($row,"profile.php",$loop);
?>
function template($row="",$tmlt="",$loop="")
$tmpfile="themes/pink/$tmlt.html";
if(!file_exists($tmpfile)){
die("File '$tmpfile' Not Found.");
}
$file=implode("",@file($tmpfile));
$file=addslashes($file);
eval("\$output=\"$file\";");
$output=stripslashes($output);
echo"$output";
}
But in the sample template(ie.profile.html) I might want to display all the pictures of the user. so I need to pass parameter and it has to be loop.
How do i printout printout loop in that html file.