John Magnolia
John Magnolia

Reputation: 16793

Silverstripe Control with Pos/Interation -1

I would like to be able to control/loop through my data to generate the following:

Loop 1 - name
Loop 2 - name1
Loop 3 - name2
- etc

I know I could use the Pos within a control although I need this to start at 0. If only I could do a simple math calculation within the SS template. I can't think how I could achieve this.

Upvotes: 2

Views: 1255

Answers (1)

John Magnolia
John Magnolia

Reputation: 16793

This can easily be solved by passing the starting number to the position.

$Pos(0) // Start at 0
$Pos(99) // Starts at 99

Upvotes: 6

Related Questions