[TYPO3-english] multiple conditions with if
Jigal van Hemert
jigal.van.hemert at typo3.org
Sun Apr 22 14:22:37 CEST 2012
Hi,
On 22-4-2012 12:32, Katja Lampela wrote:
> But I was stupid, I didn't mention the field1 is timestamp for which I
> need to make the conversion to human readable mode. The original 10
> object should have been:
>
> 10 = TEXT
> 10 {
> if {
> isTrue = ###FIELD1###
> }
> value = ###FIELD2###
> strftime = %d.%m.%
> }
>
>
> the field2 is a string.
Not much of a difference:
10 = TEXT
10 {
override {
cObject = TEXT
cObject {
value = 1234567890
ifEmpty = x
strftime = %d.%m.%Y
}
}
value = field2
ifEmpty = show some text
}
I assume that "field1" and "field2" are really database fields, so it
can become:
10 = TEXT
10 {
override {
field = field1
ifEmpty = x
strftime = %d.%m.%Y
}
field = field2
ifEmpty = show some text
}
For 'ifEmpty' zero values are seen as empty. A value 'x' makes the
strftime return nothing and thus in that case the 'override' is also empty.
So, if field1 is zero or empty, the 'override' won't do anything and
field2 takes over.
If field2 is also empty 'show some text' will be displayed.
I just love stdWrap :-)
--
Jigal van Hemert
TYPO3 Core Team member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-english
mailing list