I have a chunk of html data that I want to output for each iteration through a db result while($result){ $list.=file_get_contents("my_template_file.php"); } return $list; The template file looks like this: <table> <tr> <td><?php echo $result["name"];?></td> </tr> </table> I basically want a good way to keep the template file out of the class so I don't have to code: $list.="<table><tr>...etc The problem is with the method I have, it doesn't translate the vars...what's the best way to do this? Thanks!