On Aug 6, 10:02*pm, Sjoerd <sjoer...@gmail.comwrote:
Quote:
On 6 aug, 10:53, Egbert Teeselink <skreb...@gmail.comwrote:
>
Quote:
"mplate, a PHP template engine that Doesn't Suck(tm)" (or at least,
that's what I hope)
>
I got this:
Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING
in /home/sjoerd/www/mplate/mplate-0.2.1/Mplate/Taglib/Zend.php on line
47
>
And this:
Warning: preg_match() [function.preg-match]: Compilation failed:
unrecognized character after (? at offset 201 in /home/sjoerd/www/
mplate/mplate-0.2.1/Mplate/Compiler.php on line 437
For this regex:
~^(?P<t>.*?) (?:(?!\{ /? (?:if|else|foreach|foreachelse|ld|rd|lde|rde|
capture|strip|include|inline|raw|wrap|expandTaglib |assign|repeat|c:\w+|
p:\w+|zend:\w+)) \{ (?P<e>[^()]*? *(?P<rr2\( (?>[^()]+ | (?&rr2) )*?
\) )? *[^()]*? /?) \}|\{ (?P<f>/? (?:if|else|foreach|foreachelse|ld|rd|
lde|rde|capture|strip|include|inline|raw|wrap|expa ndTaglib|assign|
repeat|c:\w+|p:\w+|zend:\w+)[^()]*? *(?P<rr1\( (?>[^()]+ | (?
&rr1) )*? \) )? *[^()]*? /?) \}) (?P<p>.?) ~isx
Thanks for trying it out! Guess my "doesn't suck" claim was a bit
premature..
The regex bug puzzled me for a while, but now I got it - only the
latest PHP has a PCRE that supports the perl way of doing named
backreferences, or so it seems. I replaced it by an older syntax (that
I didn't know existed), so that should be fixed.
The Zend.php bug puzzles me even more, however - that file hasn't been
touched for a while (and has been included mostly as a showcase and
isn't particularly useful currently). My only guess is that PHP5
changed the way it expands variables inside strings at some new
version, but I haven't found anything in changelogs.
Obviously, I should do more testing on lower PHP versions. (and I
really hope that that was the problem).
I've published a new version at
http://e.teeselink.nl/mplate/releases/mplate-0.2.2.zip
- if that still causes the error in Zend.php, deleting the file should
fix the problem (but remove the currently pretty useless "zend:"
namespace).
Thanks for the feedback,
-egbert