[TYPO3] if... else in typo script? - don't mean standard conditions

JoH info at cybercraft.de
Tue Mar 7 20:04:10 CET 2006


>> is there a way to realize if-else conditions in TS.
>> i would like to wrap a menu item depending on its title.
>>
>> it's something like this:
>>
>> NO.wrap = <div class="style">|</div>
>> NO.wrap.if {
>>         value = test, test2
>>         isInList.field = title
>>         }
>> .... -> now i would like to have an else to specify the wrap, if the
>> title is not test or test2.
>>
>> is something like this possible? that would be great.
>
> Using "split"/"if" combination?

Nope ... much easier.
The following might help you:

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.

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.

Both should be working

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.cybercraft.de





More information about the TYPO3-english mailing list