tpl question

Joined
Oct 18, 2005
Messages
181
Reaction score
0
hi,

I'm making registration page. I made the system running on tpls. but as subaction I use .php file.

example: index.php?do=rules

I include rules.php and rules.tpl

But for registration, in tpl file I can put only design, but if I'll put my action

<img src="register.gif" border="0" class="hand" onclick="<?php print "$regsubmit"; ?>" >


in register.php, it will write Parse error: syntax error, unexpected '<'

what should I do then?


Thanx.
 
there are lots of ways to read tpl files as u say.

the most common is via a TPL parser like smarty template system which uses something like
{$varname**
and
{$arrayname.index**
for arrays

but much simpler ways is to use eval

and example would be :
function read_file($filename) {
$tmpl_file = $filename.".tpl";
$thefile = implode("", file($tmpl_file));
$thefile = addslashes($thefile);
$thefile = "\$r_file=\"".$thefile."\";";
return $thefile;
**

then u can use

eval(read_file('rules'));
echo $r_file;

in rules u can use php variables...
like
helllo my name is $name
 
Back