[TYPO3-templavoila] fce selector box how to?

Franz Koch typo3 at fx-graefix.de
Sun Apr 2 10:34:57 CEST 2006


Hi Klaus,

Have a close look at Marcs example

 >> <numIndex index="1" type="array">
 >>   <numIndex index="0">Whatever</numIndex>
 >>   <numIndex index="1">test</numIndex>
 >> </numIndex>

see the third line? This is the value that get's stored internaly if the 
option labled 'Whatever' is selected in the dropdown-box. So in this 
case a string 'test' is stored - not a number.

And when you have changed your DS that way, that selectorboxes store 
string-values, you can check against them for example with this TS Marc 
allready posted:

 >>> <TypoScript>
 >>> 10 = CASE
 >>> 10.key.field = field_select
 >>> 10.test = TEXT
 >>> 10.test.value = Text Nr. 1
 >>> </TypoScript>

Here a CASE object is created - it's like a switch/case-function in php. 
  In line 3 the key is defined that holds the compare value. This equals 
in php 'switch($field_select) {'. Then in line 4 the first case is set - 
a case-object called 'test'. This equals in php 'case "test": ... 
break;'. You can add here as many cases you like. Here an example:

-------------
lib.myExternalTS = CASE
lib.myExternalTS {
   key.field = field_select

   # default value if the value set in field 'field_select'
   # doesn't match with any of the defined cases
   default = TEXT
   default.value = some default value if value doesn't match at all

   # first case if value of field 'field_select' equals 'test'
   test = TEXT
   test.value = whatever

   # second case if value of field 'field_select' equals 'anothertest'
   anothertest = IMAGE
   anothertest {
     #...
   }

   thirdtest = TEXT
   thirdtest.field = field_header
}
-------------

got it?

May the TypoScript be with you ;)

-- 
Kind regards,
Franz Koch



More information about the TYPO3-project-templavoila mailing list