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

Muriel le Pair typo3 at strangefruit.nl
Wed Jun 12 16:03:26 CEST 2013


On 12-06-13 15:04, Xavier Perseguers wrote:
>> I still don't understand how to melt them together in my template.
>>
>> How do I display the value if I use a ViewHelper to generate a random
>> number?
>
> You should take as basis one of the "easy" VH from Fluid itself such as
> \TYPO3\CMS\Fluid\ViewHelpers\DebugViewHelper which includes everything
> you need (parameters and renderChildren().

Hi,

Thanks for your help but I still don't get it..

I have looked at the RenderViewHelper (DebugViewHelper doesn't seem to 
exist in the current api or at least I can't find it).

I want to display a random image so in good old PHP it would be 
something like:

$nr = rand(0,10);
$img[$nr];

settings.icons contains an array with images.

The ViewHelper I created works and I can output the content in the 
template like this:
<f:render partial="Cases/Images" arguments="{images:randomnr}" />

But how do I render settings.icons.[number generated by ViewHelper]?

--
king regards,


Muriel le Pair




More information about the TYPO3-english mailing list