[TYPO3-english] ST template checkboxes

Jigal van Hemert jigal at xs4all.nl
Wed Dec 28 16:51:51 CET 2011


Hi,

On 28-12-2011 10:58, Sergey Alexandrov wrote:
> I have an 'options' field in the database, which is a set of check-boxes
> I'm trying to display some message(s) depending on checked values with
> typoscript, but ... couldn't find if I can use bitwise operators in
> typoscript.
> I have no problem with a single check-box, but set of boxes is actually
> is bit set ... any ideas?

The quickest solution I could think of is two checks in your if.
For each bit you could check if it's greater or equal to the value the 
bit represents but smaller than the value the next bit represents:

bit 0: >= 1 AND < 2
bit 1: >= 2 AND < 4
bit 2: >= 4 AND < 8
bit 3: >= 8 AND < 16
....

Because "if" doesn't know 'greater than or equal' you can use 
isGreaterThan and compare to next bit value minus one:

10 = TEXT
10 {
   value = First option
   if {
     value.field = options
     isGreaterThan = 0  # >= 1
     isLessThan = 2     # < 2
   }
}
20 = TEXT
20 {
   value = Second option
   if {
     value.field = options
     isGreaterThan = 1  # >= 2
     isLessThan = 4     # < 4
   }
}
(code not tested)

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert.


More information about the TYPO3-english mailing list