Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Display a range of articles

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

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

Page: 1
Go to End
Author Topic: 1282 Views
  • Nicko
    Avatar
    Community Member
    14 Posts

    Display a range of articles Link to this post

    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

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Display a range of articles Link to this post

    I believe this would work

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

  • Nicko
    Avatar
    Community Member
    14 Posts

    Re: Display a range of articles Link to this post

    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

  • Liam
    Avatar
    Community Member
    470 Posts

    Re: Display a range of articles Link to this post

    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?

    1282 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.