I have a function called OpenTemplate (see code bellow) wich basically is used to open my templates which are php files. however, php code inside these templates will not execute. any idea how the function should be modified? thank you!
Function OpenTemplate($tempname, $error = "",$filename="",$fileext=""){
Global $formatcomment,$tempurl, $url, $uname,$password,$grand_total,$keywords,$catlist,$catlist2,$catlist3,$description,$title,$cname,$cmail,$category,$category2,$category3,$reciplink,$id,$visits,$rookie,$vet,$getmail,$rating,$search,$number,$links,$links2,$previousnext,$votes,$adddate,$min_votes,$catlinks,$catstr,$pathcategory,$numlinks,$cat_id,$catsel,$maxhighfly,$linkprint,$username,$catid,$catid2,$catid3,$maillink,$maildate,$mailfromperson,$mailfromaddress,$subject,$msgid,$body,$session,$msg,$uid,$categoryname,$ID;
include ("var.php3");
$tempfile = fopen("/myroot/templates/$tempname", "r");
if ($cachetime > 0){
$cachefile = fopen("/myroot/$filename?$fileext.cache", "w");
}
while(!feof($tempfile))
{
$templine = fgets($tempfile,255);
include("templates.php3");
if ($cachetime > 0){
fputs($cachefile,$templine);
}
print($templine);
}
fclose($tempfile);
if ($cachetime > 0){
fclose($cachefile);
}
}