[TYPO3-mvc] Fluid template problem - two arrays and no way to use the same key?
Franz Koch
typo3.RemoveForMessage at elements-net.de
Fri Sep 10 17:23:02 CEST 2010
Hi,
> I'm also currently creating my first Extbase TYPO3 Extension.
>
> I have two arrays where I have stored images and the corresponding image
> captions at the same key positions.
>
> image array {
> 0: 'logo.jpg',
> 1: 'service.png'
> }
>
> caption array {
> 0: 'Logo',
> 1: 'Service'
> }
>
> For-loop over the images-Array:
> <f:for each="{reference.image}" as="singleImage">
> <img src="uploads/pics/{singleImage}" alt="" />
> </f:for>
>
> Now I want to fill the alt-tag with the corresponding image caption.
> How can I manage that?
> Do I have to create an array with both informations?
yes, that would be a possible solution. Probably better would be to use
objects - it's at least more in the OOP way of extbase - but a
multidimensional array is also fine if that works for you.
array {
0: {
file: 'logo.jpg',
caption: 'Logo'
}
...
}
<f:for each="{reference.images}" as="image">
<f:image src="uploads/pics/{image.file}" alt="{image.caption}"
width="{settings.view.image.width}" />
</f:for>
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list