[TYPO3-mvc] Use index of iteration attribute as array index
Claus Due
claus at wildside.dk
Sun Jun 26 16:16:33 CEST 2011
Hi Claus,
If you already have the image names in the array, you should use the "as" variable name:
<f:for each="{imgSrc}" as="imageSrc" iteration="it">
<img src="{imageSrc}" />
</f:for>
--
Med venlig hilsen / Kind regards
Claus Due
Code Monkey
http://fedext.net
On Jun 26, 2011, at 4:06 PM, Claus Fassing wrote:
> Hi Claus,
>
> thank you for your answer.
>
> Am 26.06.2011 14:43, schrieb Claus Due:
>> I'm afraid that isn't possible. Fluid cannot tell wether you are referencing the variable "index" or requesting the property "index" on {imgSrc}... which is why the static {imgSrc.0} works but {imgSrc.index} does not.
>
> I can't chain a variable and a property ?
Unfortunately, no...
>
>> The solution could be to build an array of image names outside of Fluid - or use a ViewHelper to return an image name based on an index.
>
> This is exactly what I did. I build the image name array (imgSrc) in my
> controller and assign it to the view.
>
>
> Greetz, Claus
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
More information about the TYPO3-project-typo3v4mvc
mailing list