[TYPO3-project-formidable] Why are the template methods ifEmpty / ifNotEmpty commented out?

newgrp at googlemail.com newgrp at googlemail.com
Mon Mar 9 22:47:01 CET 2009


Hi Jerome,

you're right.
Thank you very much for all your help and explanations.

Kind regards,
Hauke

----- Original Message ----- 
From: "Jerome Schneider" <typo3dev at ameos.com>
Newsgroups: typo3.projects.formidable
To: <typo3-project-formidable at lists.netfielders.de>
Sent: Monday, March 09, 2009 5:00 PM
Subject: Re: [TYPO3-project-formidable] Why are the template methods ifEmpty 
/ ifNotEmpty commented out?


> 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
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable 



More information about the TYPO3-project-formidable mailing list