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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Display a range of articles


Go to End


4 Posts   1902 Views

Avatar
Nicko

Community Member, 14 Posts

10 October 2008 at 11:11pm

Edited: 10/10/2008 11:12pm

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

Community Member, 470 Posts

11 October 2008 at 5:01am

Edited: 11/10/2008 5:01am

I believe this would work

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

Avatar
Nicko

Community Member, 14 Posts

14 October 2008 at 4:39am

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

Community Member, 470 Posts

14 October 2008 at 5:00am

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?