[TYPO3-mvc] Use index of iteration attribute as array index

Claus Due claus at wildside.dk
Sun Jun 26 14:43:23 CEST 2011


Hi Claus,

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.

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.

--
Med venlig hilsen / Kind regards
Claus Due
Code Monkey
http://fedext.net

On Jun 26, 2011, at 10:36 AM, Claus Fassing wrote:

> Hello,
> 
> I try to use the index of the iteration attribute from ForViewHelper as
> array index.
> 
> Such as
> 
> <f:for each="{Foo}" as="foo" iteration="it">		
>  <f:alias map="{index: it.index}">
>    <f:image src="{imgSrc.index}" alt="foobar" width="150" />
>    <f:debug>{imgSrc.index}</f:debug>
>  </f:alias>
> </f:for>
> 
> imgSrc is an array and I get output from this with static settings
> {imgSrc.0}, {imgSrc.1} ...
> 
> But not with {imgSrc.index}
> 
> The debug output is correct 0, 1 ..
> 
> 
> Do I use the wrong syntax, or is there any other way to solve this ?
> 
> 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