About ranking question

10 views
Skip to first unread message

KuoYing@Taiwan

unread,
Dec 15, 2010, 12:11:51 PM12/15/10
to play-framework
this is my ranking.html source:
---------------------------------------------------
#{extends 'main.html' /}
#{set title:'Ranking' /}
<br>
<br>
Num | Text | Name | Tickets<br>
#{list items:top, as:'topp'}

#1 | ${topp.content} | ${topp.member.nickname} | $
{topp.memberVoteCount} 票| <br>

#{/list}
--------------------------------------------------------
I want to now how to using %{ for loop }% on #1 Tag...or has the
other ways to solve it??

I want to show answer is
#1 | Play Framework | Peter | 200
#2 | Java | Kevin | 100
#3 | Groovy | Tom |50

Ludocwi

unread,
Dec 15, 2010, 12:50:16 PM12/15/10
to play-framework
I don't know if I have understood your question well, but if you want
to display :
#1 | Play Framework | Peter | 200
#2 | Java | Kevin | 100
#3 | Groovy | Tom |50

you can do :
%{i = 1}%
#{list items:top, as:'topp'}

#${i} | ${topp.content} | ${topp.member.nickname} | $
{topp.memberVoteCount} 票| <br>

%{i++}%
#{/list}

KuoYing@Taiwan

unread,
Dec 15, 2010, 12:55:42 PM12/15/10
to play-framework
Thank you!! It is OK^_____^

Alison Winters

unread,
Dec 15, 2010, 1:36:32 PM12/15/10
to play-framework
You can also use the automatic variable ${topp_index} - the _index
variable starts at 1 in the list tag and increments by 1 on each new
list item.

Alison
Reply all
Reply to author
Forward
0 new messages