I am trying to get a zero-based counter in a Velocity #foreach directive.
if i use:
#foreach ($item in $list)
item.getName() : $veloc
Well, you can't have both, obviously--you either need to just do the math when you're displaying, or create a custom directive (and here's the article the SO post links to). For instance, you could have #forEachZeroBased and #forEachOneBased.
Custom directives are very useful sometimes, although IMO this isn't one of them--just do the math, it's the obvious solution, and it's just not that big of a deal.