[TYPO3-mvc] Fluid - using an array in condition?
Sebastian Kurfürst
sebastian at typo3.org
Mon May 10 16:59:41 CEST 2010
Hey Stefan,
> But it seems that "{checkedItems.index}" is not equivalent to
> {checkedItems.0}, {checkedItems.1}, ...
> Is there another syntax, or is it not possible?
Right now, that's not possible without a custom ViewHelper.
The reason is that you would like to write {checkedItems.{index}}, which
is not supported right now... And from the parser side, I am not sure if
this still makes the language unambiquous. That's why I cannot guarantee
this feature will be implemented in the upcoming time.
You can, however, write an Array Access view helper, which does what you
want, with the following signature:
<my:array array="{checkedItems}" index="{index}" />
... and you can use it in the shorthand syntax as follows:
{my:array(array: checkedItems, index: index)}
This shorthand syntax can be plugged into the <f:if, and there you go:
<f:if condition="{my:array(array: checkedItems, index: index)}">
Greets,
Sebastian
More information about the TYPO3-project-typo3v4mvc
mailing list