[TYPO3-english] display random value from array in fluid template

Muriel le Pair typo3 at strangefruit.nl
Thu Jun 13 11:34:38 CEST 2013


On 13-06-13 08:28, Xavier Perseguers wrote:
> A complete example would help a lot.

What I want is basically very simple: every case contains a set of 
tooltips. Each tooltip uses an icon. These icons should appear in random 
order.

<f:for each="{cases.tooltips}" as="tooltips">
    <f:image src="{settings.icons[randomnr]}" alt="" 
style="top:{tooltips.positiontop}px;left:{tooltips.positionleft}px;" 
title="{tooltips.titel} {tooltips.tekst}" />
</f:for>

Since TypoScript generates an array by default I thought would make 
sense to define them there.
Something like:

settings {
    icons {
       1 = icon1
       2 = icon2
       3 = icon3
    }
}

I can of course shuffle the settings.icons with a ViewHelper.
But I still havened figured out how to loop through the array. The 
equivalent of $i++;

--
kind regards,

Muriel le Pair








More information about the TYPO3-english mailing list