[TYPO3-mvc] Fluid: Avoid iteration in <f:for each> loop, if condition is false
Gianluca Strafella
gianluca.strafella at webformat.com
Tue Oct 15 14:21:41 CEST 2013
Hi Martin,
I don't know a way to do it with the Fluid tags. Widget "paginate" works
with the collection "stoerungsmeldungs" and it works with blocks of 10
items.
You could filter the collection in your Controller (server side), moving
"if" there, otherwise you could be use a javascript paginator to count
10 records per page.
Regards,
Gianluca Strafella
Software Developer
gianluca.strafella at webformat.com
Tel. +39-0427-926.389
WEBFORMAT srl – www.webformat.com
Via Mecenate, 76 - 20138 MILANO
Corte Europa, 12 - 33097 SPILIMBERGO (PN)
Il 15/10/2013 12:23, Martin Wagner ha scritto:
> Hi Forum,
>
> I create an app with several frontend users.
>
> At the list view there should be only entries from the user show, which
> is logged in at the frontend and which are created by himself.
>
>
> <f:widget.paginate objects="{stoerungsmeldungs}"
> as="paginstoerungsmeldungs" configuration="{itemsPerPage: 10}">
> <f:for each="{paginstoerungsmeldungs}" as="stoerungsmeldung"
> iteration="iterator">
> <f:if condition="{stoerungsmeldung.username} == <f:cObject
> typoscriptObjectPath='lib.feuser' />">
> <f:then>
> <div class="meListWrap">
> <h2>Listeneintrag {stoerungsmeldung.username}</h2>
> </div>
> </f:then>
> </f:if>
> </f:for>
> </f:widget.paginate>
>
>
> lib.feuser contains the current logged-in user,
> {stoerungsmeldung.username} is the id of the creator.
>
> So far it works. But there are not 10 list entries always, because the
> <f:for each> loop counts also, if the condition is false.
>
> Is there a chance to get 10 entries per page, or is it impossible with
> Fluid and I have to make it with filters?
>
> any help appreciated!
More information about the TYPO3-project-typo3v4mvc
mailing list