I've modified PHPLib templates to allow this, so maybe you could do something similar? I changed the function used to load the templates, so that instead of reading the file you used ob_start(), then included the file, and then took the contents of ob_xxx and used that as the file. of course it only works with PHP4 :-)
I subclass the template, and this is my replacement load_file class which goes inside the subclass
function loadfile($varname) {
if (!isset($this->file[$varname])) {
// $varname does not reference a file so return
return true;
}
if (isset($this->varvals[$varname])) {
// will only be unset if varname was created with set_file and has never been loaded
// $varname has already been loaded so return
return true;
}
$filename = $this->file[$varname];
/* use @file here to avoid leaking filesystem information if there is an error */
// $str = implode("", @file($filename));
if (floor(phpversion()) == 3) {
$str = implode("", @file($filename));
} else {
$str = _parseFile($filename);
}
if (empty($str)) {
$this->halt("loadfile: While loading $varname, $filename does not exist or is empty.");
return false;
}
$this->set_var($varname, $str);
return true;
}
HTH!
Peter.