[Flow] [Fluid] How can I use dynamic array indexes in templates?
Pavlina
pavlinadrosos at gmail.com
Tue Jun 11 21:29:11 CEST 2013
Hi all!
I am new in Typo3 Flow and I am currently developing my first project with it. I use Typo3 Flow 2.0 beta 1.
I understood from this post:
http://forge.typo3.org/projects/typo3v4-mvc/wiki/FAQ#How-can-I-use-dynamic-array-indexes
that it's not possible to use dynamic array indexes in templates. But I need it very much. I have an array of arrays - items, grouped by week day - and I need to dynamically access each sub-array trough a weekDay variable and iterate it with the foreach view helper.
I have found this code:
https://gist.github.com/afoeder/2406841
and I used it to write a custom view helper. My idea was to get each sub-array dynamically and pass it to the foreach view helper like this:
<f:for each="<my:arrayAccess array={tasksGroupByWeekDay} key={weekDay} />" as="task">
or
<f:for each="{my:arrayAccess(array: tasksGroupByWeekDay, key: weekDay)}" as="task">
But the custom view helper does not pass the array to the foreach view helper, it directly renders it in the template, which is obviously not what I heed. I couldn't find a way to write a view helper, which returns a value without render it in the template.
Any help or suggestion which is the correct way to achieve my goal will be highly appreciated!
Thank you in advance,
Pavlina
More information about the Flow
mailing list