Sie befinden sich hier: Typo3 / Tipps / if ... else in typoscript
Deutsch
English
Mittwoch, 26.09.2018

if ... else in typoscript

Das Konzept von if ... else in Typoscript ist nicht einfach verständlich. Ein recht anschauliches Beispiel ist folgendes:

The following might help you:

TypoScript
NO.allWrap = <div class="style1">|</div>
NO.allWrap {
   override = <div class="style2">|</div>
   override.if {
      value = test, test2
      isInList.field = title
   }
}

"Else" is already set as a default for allWrap.
This will be overriden if "isInList" is true.

Another option would be having two differente elements inside a COA.

TypoScript
NO.allWrap.cObject = COA
NO.allWrap.cObject {
   10 = TEXT
   10.value = <div class="style1">|</div>
   10.if {
      value = test, test2
      isInList.field = title
   }
   20 = TEXT
   20.value = <div class="style2">|</div>
   20.if {
      value = test, test2
      isInList.field = title
      negate = 1
   }
}

With negate = 1 you simply switch between true and false.

Quelle: http://lists.netfielders.de/pipermail/typo3-english/2006-March/021591.html