[TYPO3-project-formidable] Why are the template methods ifEmpty / ifNotEmpty commented out?
Jerome Schneider
typo3dev at ameos.com
Mon Mar 9 17:00:17 CET 2009
Hi Hauke,
> tell me how I can achieve that a part of the template is only shown if
> storedData("dbfield") is not empty?
you might do this:
<!-- ###storedData("dbfield") perimeter### begin-->
as if storedData("dbfield") is set to "" empty string, the perimeter
will be bypassed
to be more verbose:
<!-- ###storedData("dbfield").equals("") perimeter### begin-->
or, if the field is numeric:
<!-- ###storedData("dbfield").equals(0) perimeter### begin-->
Now, if you want the opposite, just do:
<!-- ###storedData("dbfield").equals("").isFalse() perimeter### begin-->
To answer the why of the comments around ifEmpty() and ifNotEmpty(): I
decied to comment out these methods as the way they're working made
things difficult to understand (I thought so) If needed, we can think of
a better implementation, maybe ?
Thank you for your help, it's much appreciated !
Jerome
Hauke Hain a écrit :
> Ok,
> I think I know why.
> case "ifNotEmpty": {
>
> if(tx_ameosformidable::templateDataAsString($mData) === "") {
> return TRUE;
> }
>
> return $mData;
> break;
> }
>
> If TRUE is returned the part that is empty is shown.
> And if you set it to FALSE:
> case "ifNotEmpty": {
>
> if(tx_ameosformidable::templateDataAsString($mData) === "") {
> return FALSE;
> }
>
> return $mData;
> break;
> }
>
> It works like it should, but a JavaScript exception arises.
>
> Can you fix this problem or tell me how I can achieve that a part of the
> template is only shown if
> storedData("dbfield") is not empty?
>
> Now I use:
> <!-- ###storedData("backup").ifNotEmpty() perimeter### begin-->
>
> But also
> <!-- ###storedData("backup").isTrue() perimeter### begin-->
> would be possible if isTrue would use "==" instead of "===", but thats
> not really a solution...
>
>
> Kind regards,
> Hauke
More information about the TYPO3-project-formidable
mailing list