[Typo3-dev] TS_CASE object does not support key value 0
Martin Ficzel
martin.ficzel at gmx.de
Fri Oct 28 19:56:54 CEST 2005
i stumbled over a problem writing a typoscript to change the
tt_content.imagetext settings depending on the imageorient table
you can reproduce the problem with this ts-code
> page.20 = CASE
> page.20 {
> key = 0
> 0 = TEXT
> 0.value = nothing
> 1 = TEXT
> 1.value = one
> }
the key "0" is not rendered but many tablerows use this value as
default. using the "default" key instead is not always a nice solution
since it is sometimes intended to handle the value "0" different. in
such a case i now have to write a default key and extra keys for every
other possible value. thats not elegant and attracting errors.
i examined the sourcecode and found the following issues
at first i found out that a ts-line like "anyobject.0 = foobar" is not
parsed as ["anyobject"]["0"]["foobar"] because the value 0 is ignored by
the ts-parser. i suggested a patch for that ( bug id:0001736 )
afterwards in the case object the value 0 is also not supported , insted
of that the default key is rendered but thats not always what i intend.
i also suggested a patch for that ( also bug id:0001736 )
question 1 : do you think these changes make sense ? or do they cause
side effects i cant see right now?
question 2 : is it a good idea to check using "if(isset($value))"
instead of "if($value)"
comparison examples to show the differences
> if (isset("")) = 1
> if (isset(NULL)) = 0
> if (isset("0")) = 1
> if (isset("1")) = 1
>
> if ("") = 0
> if (NULL) = 0
> if ("0") = 0
> if ("1") = 1
regards Martin
More information about the TYPO3-dev
mailing list