PHP TEMPLATE SYSTEM WITH SIMPLE TAGS AND FORM

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
royce
Forum Newbie
Posts: 9
Joined: Mon Nov 11, 2002 9:57 pm

PHP TEMPLATE SYSTEM WITH SIMPLE TAGS AND FORM

Post 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!
User avatar
PaTTeR
Forum Commoner
Posts: 56
Joined: Wed Jul 10, 2002 7:39 am
Location: Bulgaria
Contact:

Post by PaTTeR »

Take a look at PEAR classes
http://pear.php.net
royce
Forum Newbie
Posts: 9
Joined: Mon Nov 11, 2002 9:57 pm

Post by royce »

That didn't help me much. Anybody else?
User avatar
dotxp
Forum Newbie
Posts: 9
Joined: Tue Nov 12, 2002 9:48 am
Location: Germany, FFM
Contact:

Post 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
royce
Forum Newbie
Posts: 9
Joined: Mon Nov 11, 2002 9:57 pm

Post by royce »

Crap, I think I'm too much of a begginer to understand it. Thanks though!
User avatar
dotxp
Forum Newbie
Posts: 9
Joined: Tue Nov 12, 2002 9:48 am
Location: Germany, FFM
Contact:

Or...

Post 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 ).
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

There's also preg_replace().

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

Mac
Post Reply