Monday, 20 August 2012

Typoscript nested if

Sometimes I need to have nested (AND) if statements in typoscript. I often try using the following:

10 = TEXT
10.value = Foo Bar
10.if.value = Foo
10.if.equals = Foo
10.if.isTrue.if.value = Bar
10.if.isTrue.if.equals = Bar

Which will fail to work at all. Why? The nested if must return something for the isTrue to work, so adding the line:

10.if.isTrue.wrap = 1

will fix the problem.

2 comments:

  1. This is quite an good example of Typoscript nested if, but still I think there is a limitation to nested condition when the case goes little bit hard. Typoscript doesn't support nested that well as others does.

    ReplyDelete
  2. this is just great. exactly what i was looking for. yey :)

    ReplyDelete