Abhishek Singh
Abhishek Singh

Reputation: 131

Silverstripe loop

<%loop $Video.Limit(4) %><% end_loop %>
<%loop $Video.Limit(5,9) %><% end_loop %>

Two divs are being used to display the data,the above code is not working. Any help is accepted.

Upvotes: 0

Views: 201

Answers (1)

wmk
wmk

Reputation: 4626

as @Zauberfisch stated here you need to use limit(4) (note the lowercase) in your template.

Another problem is the missing space between <% and loop.

Assuming $Video is some kind of SS_List (ArrayList or DataList), you could try

//show the first 4 videos
<% loop $Video.limit(4) %>$Title <% end_loop %> 
//gets the next 9 videos, offset is 5
<% loop $Video.limit(9,5) %>$Title <% end_loop %> 

See API docs for limit

Upvotes: 3

Related Questions