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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Control only last (any choice of #) pages created?


Go to End


611 Views

Avatar
wilsonStaff

Community Member, 143 Posts

4 February 2012 at 3:58pm

HI guys,

- i have a sub-pages systems that CMS-users add members (using a custom MembrePage class) to a lettered-class ordering, from A to Z.

- those section A to Z are childs of a main page, name MemberAll.

- so if client add a member whose companie's name begin with a "B", the page is added into the B sub-section.

- i have a page (NewMembrePage) that MUST display the latest entries within the MembreAll page (so within A - Z sections

Presently, end-users add the new entries manually, so both into the B-section AND into NewmembrePage

QUESTION: how can i have the NewMemberPage reflects the new entries, be they from D, H or any lettered-section?

Ive read about $Created.Nice that returns the date of creation.

In my head, the code would be like:

//*** IN NEWMEMBREPAGE ***//

<% control Page (MembreAll) %> /* look into MembreAll page */
     <% control Children %> /* look into all lettered sections from A - Z pages */
           $Created. Last(5) /* pick the last 5 created */
      <% end_control %> 
<% end_control %>

if i wanted to show last 5 entries.

Know its not that, but thats what id like to do.

Any clue?

Thanks!