As opposed to using an include, which executes the included php in the file...is it possible to save the contents of a php file to a variable - but with the php still intact and
Doing the include into the loop is not SO dumb.
All variables defined before the include will be accessible into your template.
Keep it simple !
== EDIT ==
Or maybe you could improve alex's answer :
function getTemplate($file, $template_params = array()) {
ob_start(); // start output buffer
extract($template_params); // see PHPDoc
// from here $var1 will be accessible with value "value1"
// so your template may contain references to $var1
include $file;
$template = ob_get_contents(); // get contents of buffer
ob_end_clean();
return $template;
}
echo getTemplate('your_template.php', array('var1' => 'value1'));
(Not so simple anymore ^^)