Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Display a range of articles


Reply

4 Posts   1297 Views

Avatar
Nicko

10 October 2008 at 11:11pm (Last edited: 10 October 2008 11:12pm), Community Member, 14 Posts

Hi,

On the news holder page of my website I am wanting to highlight the latest 3 articles seperately and have the rest of the articles display in a list format.

I know how you can display the top 3 articles (as per tutorial) but is their any way silverstripe can extract a range (ie 4-10) or (<4)?

Hope you can help.

Thanks

Avatar
Liam

11 October 2008 at 5:01am (Last edited: 11 October 2008 5:01am), Community Member, 470 Posts

I believe this would work

<% control News %>
<% control Range(4,10) %>
$Content
<% end_control %>
<% end_control %>

Avatar
Nicko

14 October 2008 at 4:39am Community Member, 14 Posts

Hi LeeUmm,

Thanks for your response. Unfortunately it didn't work for me. I tried as you suggested as follows:

<% control Children %>
   <% control Range(0,3) %>
      <p><a href="$Link" title="{$Title}">$MenuTitle</a> - $Date</p>
   <% end_control %>
<% end_control %>

This displays nothing.

If I take out the control Range part it displays all the articles but it just won't work with the range. Is their anything that I might be missing here?

Thanks

Nick

Avatar
Liam

14 October 2008 at 5:00am Community Member, 470 Posts

Hmm sorry, I've never used it myself, I had just remembered reading it in the forums a while back.

Just did a quick search and found the topic that I was thinking of.

http://www.silverstripe.com/extending-hacking-silverstripe-forum/flat/160555

Maybe some more info there?