I have been trying few different approaches trying to get rid of the underfined variable notices with no luck. Below code is what’s causing the notice but i couldn’t seem to locate the problem:
function DisplayLayout($template, $variables) {
$result=implode(file($template), "");
eval( "global $variables;");
$variables = str_replace(",","",$variables);
$var_list = explode("\\$",$variables);
$i=0;
while($i<=sizeof($var_list)) {
if(isset($var_list[$i]))
$result = str_replace("<%$var_list[$i]%>",$$var_list[$i],$result);
$i++;
}
print $result;
}
Notice the line if(isset($var_list[$i])), that took care of the undefined offset notices but not the variables.
I understand that I can turn the error reporting off but I would rather learn how to deal with the issue, if possible.
Any pointer or suggestion as to how to proceed is greatly appreciated.
thanks.