[TYPO3-project-formidable] Template Engine: Bug when using isLoggedIn().isFalse() twice
Hauke Hain
newgrp at googlemail.com
Wed Feb 25 19:57:54 CET 2009
Regular Expressions are powerful, but not easy to understand.
I do not understand how the function processPerimetersCallBack is called.
It is calles via
$sHtml = preg_replace_callback(
$sPattern,
array(
&$this,
"processPerimetersCallBack"
),
$sHtml,
-1 // no limit
);
But how does it get its parameter?
The problem with processPerimeters is, that Match[3] contents the whole
content from the first <!-- ###isLoggedIn().isFalse() perimeter### begin-->
to the last <!-- ###isLoggedIn().isFalse() perimeter### end-->....
And sorry, I said a few hours ago, that this only happens with
isLoggedIn().isFalse() - it seems to happen with every condition which is
used more than once.
I changed in the regular expression that not every a-z and A-Z charackter is
ok, but every charackter that is not the first group-string:
[^\\1.]
Replace
$sPattern = '/\<\!\-\-.*(\#\#\#(.+)\
\bperimeter\b\#\#\#).*begin\-\-\>([\w\W]*)\<\!\-\-.*\\1.*end\-\-\>/';
with
$sPattern = '/\<\!\-\-.*(\#\#\#(.+)\
\bperimeter\b\#\#\#).*begin\-\-\>([^\\1.]*)\<\!\-\-.*\\1.*end\-\-\>/';
Now everything is shown and nothing left, but *some* parts are shown, that
shouldn't.
The first <!-- ###isLoggedIn().isFalse() perimeter### begin--> ... <!--
###isLoggedIn().isFalse() perimeter### end--> Part is shown or hidden as it
should be.
The second Part is always shown.
At least nothing is left anymore.
I hope you can fix the rest. That was enough for today.
Sincerely,
Hauke
More information about the TYPO3-project-formidable
mailing list