ok, here is my fuction that opens my templates, for some reason php code (i know no php in templates, but i need some) will not execute in template file which is a normal php file. please help, what is wrong with the function.
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);
}
}