Reputation: 149
I want to render a news item from the News extension, but in the detail view I want to render all images except the first image. I have tried this, seek a solution through a iteration, but somewhere is still a fault has occurred.
The code is:
{namespace n=GeorgRinger\News\ViewHelpers}
<f:for each="{media}" as="mediaElement" iteration="iter">
<f:if condition="{iter.index}" >1>
<div class="mediaelement mediaelement-image">
<f:if condition="{mediaElement.link}">
<f:then>
<f:link.page pageUid="{mediaElement.link}" target="{n:targetLink(link:mediaElement.link)}">
<f:image image="{mediaElement}" title="{mediaElement.title}" alt="{mediaElement.alternative}" maxWidth="{settings.detail.media.image.maxWidth}" maxHeight="{settings.detail.media.image.maxHeight}" />
</f:link.page>
</f:then>
<f:else>
<f:if condition="{settings.detail.media.image.lightbox.enabled}">
<f:then>
<a href="{f:uri.image(image:'{mediaElement}', width:'{settings.detail.media.image.lightbox.width}', height:'{settings.detail.media.image.lightbox.height}')}" title="{mediaElement.title}" class="{settings.detail.media.image.lightbox.class}" rel="{settings.detail.media.image.lightbox.rel}">
<f:image image="{mediaElement}" title="{mediaElement.title}" alt="{mediaElement.alternative}" maxWidth="{settings.detail.media.image.maxWidth}" maxHeight="{settings.detail.media.image.maxHeight}" />
</a>
</f:then>
<f:else>
<f:image image="{mediaElement}" title="{mediaElement.title}" alt="{mediaElement.alternative}" maxWidth="{settings.detail.media.image.maxWidth}" maxHeight="{settings.detail.media.image.maxHeight}" />
</f:else>
</f:if>
</f:else>
</f:if>
</div>
<f:if condition="{mediaElement.description}">
<p class="news-img-caption">
{mediaElement.description}
</p>
</f:if>
</f:if>
</f:else>
Perhaps someone is able to help?
Upvotes: 2
Views: 659
Reputation: 149
Sorry , I have worked in the wrong Partial . Not the FalMediaImage need to be adjusted but the FalMediaContainer .
<f:if condition="{media}">
<!-- fal media files -->
<div class="news-img-wrap">
<f:for each="{media}" as="mediaElement" iteration="iter">
<f:if condition="{iter.index} >0">
<div class="outer">
<f:if condition="{mediaElement.originalResource.type} == 2">
<f:render partial="Detail/FalMediaImage" arguments="{mediaElement: mediaElement, settings:settings}"/>
</f:if>
<f:if condition="{mediaElement.originalResource.type} == 4">
<f:render partial="Detail/FalMediaVideo" arguments="{mediaElement: mediaElement, settings:settings}"/>
</f:if>
<f:if condition="{mediaElement.originalResource.type} == 5">
<f:render partial="Detail/FalMediaImage" arguments="{mediaElement: mediaElement, settings:settings}"/>
</f:if>
</div>
</f:if>
</f:for>
</div>
</f:if>
Maybe it will help someone else who has the same problem as me ?
Upvotes: 0
Reputation: 4271
You have a syntax error in your f:if
:
<f:if condition="{iter.index}" >1>
Should be:
<f:if condition="{iter.index} > 1">
(quote misplaced - whitespace after the >
is just for prettiness.
Upvotes: 3