Home
> MonoRail > Monorail + NVelocity + How to find out if your in the first item of a foreach loop?
Monorail + NVelocity + How to find out if your in the first item of a foreach loop?
17 May, 2007
A colleague needed to add a button to the first row of a table but how do you do this in a foreach loop?
NVelocity has a property called $velocityCount which you can check within the foreach loop:
<table> #foreach($detail in $details) <tr> <td> $detail.ShortText) #if($velocityCount == 1) First Row! #end </td> </tr> #end </table>
Categories: MonoRail