fasttemplates & php4
| From: | Eric Persson | Date: | Sat, 12 Aug 2000 08:48:10 +0000 |
| Subject: | fasttemplates & php4 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11444@lists.php.net to get a copy of this message | ||
Hi !
I've been using the fasttemplate class for quite some time now together
with php3 and liked it a lot. I tried other classes and things, but I
prefer the ft class since i learnt all the features now.
But when upgrading to php4 I got strange errors which seems to be caused
by some regex change from version 3 to 4.
I tried sending a mail to the author of ft without results, he even
states that ft should be php4 compatible. I might be stupid or have made
something wrong, i really dont know right now, so please enlighten me.
:-)
Below is the mail describing the problem included.
Best regards
Eric Persson
-------------MAIL--------------
I've been using ft for a while now with great happiness. I recently
upgraded from php3.0.16 to php4.0.1pl2 and discovered som weird stuff
going on in sites that worked before upgrading. I immediatley took the
php4 down and put 3.0.16 up again to get it all going.
I also took php4 up on another port to try to fix the problems, with
slight success.
The ereg() function seems to work different in php4, since it doesnt
remove the curly braces. So if i do:
$variable="foobar";
$tpl->assign(VARIABLE, $variable);
i get {foobar} printed on the page.
I looked at the ereg expression and added a backslash before the two
{'s( ereg_replace("\{$key\}","$val","$template"); ). And managed
to get
the braces away.
Then the next problem showed up, maybe it have a easy explanation or
something, but i havent managed to solve it.
It has to do with the inparsing of dynamic blocks in another template
file.
Something like this:
# I first define the files and the blocks
$tpl->define(array( blockfile => "blockfile.html"));
$tpl->define_dynamic("block", "blockfile");
for($i=0;$i<10;$i++){
$tpl->assign(VARIABLE_IN_BLOCK_FILE, "value".$i);
# below is where i expect strange things happening.
$tpl->parse(SOMETHING, ".block");
}
#The parse the complete blockfile to a location in another defined
template.
$tpl->parse(PLACE_TO_BE, "blockfile");
---------
When running php3.0.16 i got the whole content of blockfile parsed to
{PLACE_TO_BE} including all iterations in the dynamic block. Insted in
php4 I got SOMETHING to replace {PLACE_TO_BE}.
It might occur since i changed in the wrong way in all eregs..but Im not
sure.
I would appreciate any input on this.
Thanks in advance.
Eric