Page 1 of 1

PHP TEMPLATE SYSTEM WITH SIMPLE TAGS AND FORM

Posted: Mon Nov 11, 2002 10:35 pm
by royce
I'm looking for a simple template type program that will do the following...

A template page like this for example
<html>
<body bla bla bla>
<b>$variable1</b>
joe smoe went to the $variable2 and bought some $variable3
</body>
</html>

A form like this
<form method=post action="update.php">
<input type=text name="variable1" value="<?php echo $variable1;>">

I wont write the rest, you get the point. So the form input would replace the variables in the template file and write a new file. Seems simple to do but I can't figure it out. I'm kinda new to this stuff. Thanks for any help anyone can give!

Posted: Tue Nov 12, 2002 4:58 am
by PaTTeR
Take a look at PEAR classes
http://pear.php.net

Posted: Tue Nov 12, 2002 9:56 am
by royce
That didn't help me much. Anybody else?

Posted: Tue Nov 12, 2002 10:04 am
by dotxp
PEAR has got 2 of the best Template-Engines.

Look at http://pear.php.net/package-info.php?pacid=108 for the Template IT. It's very smart and easy. Just variables are inserted with {...}, not $...

And if it is to simple for you, Flexy (http://pear.php.net/package-info.php?pacid=111), which is more powerfull.

Hope i could help you!

Regards,
Toby

Posted: Tue Nov 12, 2002 10:19 am
by royce
Crap, I think I'm too much of a begginer to understand it. Thanks though!

Or...

Posted: Tue Nov 12, 2002 10:45 am
by dotxp
... if you just want a thing, that replaces "$var"-like tags inside a template, use the ereg_replace() (see: function http://www.php.net/manual/en/function.ereg-replace.php ).

Posted: Tue Nov 12, 2002 1:23 pm
by twigletmac
There's also preg_replace().

For more info on regular expressions: http://www.php.net/manual/en/ref.pcre.php

Mac