Template engine: help!!!
Posted: Fri Jul 30, 2004 1:42 pm
-This is my Templates.html
<html>
...
<body>
Var 1: {var[1]}
Var 2: {var[2]}
...
</body>
</html>
so in file Template.php, I have 3 function: getContents(), setVars() and out()
in getContents(), the first: fopen($filename,"r") and the second: $contents = fread($filename,filesize($filename));
in out(), I use echo $contents;
but in setVars(), I don't know how to parse values into vars in $contents.
EXP: values[1]=a, values[2]=b I want to parse them to {var[1]} {var[2]}... I try use PHP function preg_replace but.. hix hix hix!
last, before echo $contents, do I replace char " in $contents = \" ...?
Thank!!!
<html>
...
<body>
Var 1: {var[1]}
Var 2: {var[2]}
...
</body>
</html>
so in file Template.php, I have 3 function: getContents(), setVars() and out()
in getContents(), the first: fopen($filename,"r") and the second: $contents = fread($filename,filesize($filename));
in out(), I use echo $contents;
but in setVars(), I don't know how to parse values into vars in $contents.
EXP: values[1]=a, values[2]=b I want to parse them to {var[1]} {var[2]}... I try use PHP function preg_replace but.. hix hix hix!
last, before echo $contents, do I replace char " in $contents = \" ...?
Thank!!!