I'm using FastTemplate for php in my website. If I import the index.tpl in the index.php and make titles and links with: $obj->assign(TITLE, "title"); $obj->assign(LINKNAME, "foo.php");
and in .tpl: <TITLE>{TITLE}</TITLE> <a href= {LINKNAME}>bar</a>
it does not work. Maybe I had missed to configure the class.FastTemplate.php3 right or something else....
Please help me!
I've always used a slightly different syntax, from the samples supplied with the source:
$obj->assign(array( TITLE => "title", LINKNAME => "foo.php" ));
that, of course, after using:
$obj->define(array(FILEHNDL => 'filename.tmpl'));
Cheers, Sean.
Thank you Sean but I use it also in a array and it does not work! my title appears over my site as : {TITLE}
and my links produce something like that(when I klick on it):
http://localhost/{foo.php}
plz again: help me!
The only other thing I can think of is that class.FastTemplate.php has an error in it's regular expression (posted on http://thewebmasters.net as a patch, which this inferior PHP'er should learn how to use one day) on line 199 and 200:
$template = str_replace('{' . "$key" . '}',"$val","$template");
Note the separated quotes around the '{' and '}'. Also note that I've commented out the ereg_replace line and used the str_replace line.. supposedly its faster, if using the correct version of PHP..
Hope that helps.
Sorry Sean, no way. I change it to str_replace but it doesn't work. The only error are the '{}' around the link. So html cannot parse the href="" and <title></title> and make this errors. Can anyone other help me please?