[Typo3] Templavoila FCE ->how to check if value is empty?

Bernhard Kraft kraftb at kraftb.at
Tue Dec 20 17:34:12 CET 2005

Andreas Jonderko wrote:

> temp.check = TEXT
> temp.check.current = 1
> temp.if{
> value = temp.check.value
> isTrue.field =
> }

To make it short: .if let's you output something depending on a condition.

You cannot form if-else statments saying output that and if it's not true
output that - at least not without a little trick :)

For example if you have a code like the following in your DS-XML:

10 = TEXT
10.current = 1

it will just ouput the value of the current field.

If you write

10 = TEXT
10.value = Nothing set !
10.if.value.current = 1
10.if.equals =

it will compare the current value to "" (nothing ... .equals = )
if they match (current == "") it will return true which will result
in letting "Nothing set !" get outputted. You can read in TSRef:
> if : If the if-object returns false, stdWrap returns "" immediately

which means if there is something set for .current in the above statement it
will return false and not output "Nothing set !"

if you want to output something and when it's not set a default value you
can now dow something like:

10 = TEXT
10.value = Nothing set !
10.if.value.current = 1
10.if.equals =

20 = TEXT
20.current = 1

which will output "Nothing set !" if there is nothing "in" .current and if there is
something in it .10 will output nothing and .20 will output the contents.

You could create a wiki page about the usage of .if .. i will surely add some notes to it :)


More information about the TYPO3-english mailing list