Template engine: help!!!

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
docochild
Forum Newbie
Posts: 1
Joined: Fri Jul 30, 2004 1:42 pm
Location: Viet Nam

Template engine: help!!!

Post by docochild »

-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!!!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply