function getFile($filename) {
if (!$filename) {
return 0;
}
$filename = "tmpl/" . $filename . ".tmpl";
$fp = fopen($filename,r);
if (!$fp) {
return 0;
}
$data = fpassthru($fp);
fclose($fp);
return $data;
}
$name = "My Name";
eval("dooutput(\"welcome\");");
I am currently using this code to call templates from a folder then have eval help parse the vaiables..
I get a few errors.
echo getFile("welcome"); // Outputs:Hello $name11
Now the 11 isnt in the template and I am unsure as to how it gets in there.
$name = "My Name";
eval("dooutput(\"welcome\");");
Once I use this code though, it just outputs: Hello $name
I am confused as to why this isnt working, if you can help that would be great.
- Rayn