Hi. I have the following function which despite the fact that it works ok it returns me some errors in the log file which i have to fix.
function DisplayTemplate($templatefile, $vars) {
$line=implode(file($templatefile), "");
eval( "global $vars;");
$vars = str_replace(",","",$vars);
$var_list = explode("\$",$vars);
$i=0;
while($i<=sizeof($var_list)) {
$line = str_replace("<%$var_list[$i]%>",$$var_list[$i],$line);
$i++;
}
print $line;
}
The log file returns more than 10 errors per reload about :
Undefined offset: 4 in ..
Undefined offset: 3 in ..
Undefined variable: in .. (it doesn't say which variable)
All the errors is about the red line
I can't figure out what's wrong so i'd appreciate any help.
Thanks
John