PHP - Executing PHP from a string
<p>This one is a bit of a weird one. Ive created a function designed to select a template and either include it or parse the %0, %1,%3 etc. variables. This is the current function:</p>

<pre><code>if(!fopen($tf,"r")){
    $this-&gt;template("error",array("404"));
}
$th = fopen($tf,"r");
$t = fread($th, filesize($tf) );
$i=0;
for($i;$i&lt;count($params);$i++){
    $i2 = '%' . $i;
    $t = str_replace($i2,$params[$i],$t);
}
echo $t . "\n";
fclose($th);
</code></pre>

<p>Where $th is the relative directory to my template file. My issue is, I need to execute the PHP inside of these files whilst at the same tme being able to replace the string variables %0 %1 etc.
How could I go about attempting this?</p>
