Am 06.05.15 um 10:57 schrieb Tomasz Krawczyk:
Hi!

I make list of players of hockey team. I divided that list in three
parts attackers, defenders and goalkeepers. I have playerss in one model.

So I simply walk through players selecting player position.

<f:for each="{players}" as="player" iteration="iterator0">
     <f:if condition="{player.position} == 0"> // attackers
     <f:then>
         <f:if condition="{iterator0.isOdd}">
         <f:then>
         <tr>
         </f:then>
         <f:else>
         <tr class="even">
         </f:else>
         </f:if>
             <td class="r">{iterator0.cycle}</td>
             <td>{player.lastName} {player.firstName}</td>
(...)


<f:for each="{players}" as="player" iteration="iterator1">
     <f:if condition="{player.position} == 1"> // defenders
     <f:then>
         <f:if condition="{iterator1.isOdd}">
         <f:then>
         <tr class="odd">
         </f:then>
         <f:else>
         <tr class="even">
         </f:else>
         </f:if>
             <td class="r">{iterator1.cycle}</td>
             <td>{player.lastName} {player.firstName}</td>
(...)

<f:for each="{players}" as="player" iteration="iterator2">
     <f:if condition="{player.position} == 2"> // goalkeepers
     <f:then>
         <f:if condition="{iterator2.isOdd}">
         <f:then>
         <tr class="odd">
         </f:then>
         <f:else>
         <tr class="even">
         </f:else>
         </f:if>
             <td class="r">{iterator2.cycle}</td>
             <td>{player.lastName} {player.firstName}</td>
(...)


The problem is that
iterator1 starts from (iterator0 + 1),
iterator2 starts from (iterator1 + 1)
but not from 1.

you run the iterators always for the whole array.
your intention to count only the selected (posiotion ==...) items could not be realized in this way. Either you build other select queries ( ~ WHERE position == ...) to have three arrays only with items with current position or you build up your own iterator you only increase inside the filtering f:if.

How can I change it?

bernd
--
http://www.pi-phi.de/cheatsheet.html
_______________________________________________
TYPO3-english mailing list
TYPO3-english@lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english

Reply via email to