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:

Archive /

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

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

Archive the news?

Go to End

3 Posts   2399 Views


4 Posts

9 August 2007 at 1:51am

I installed this for a client - and now they're asking for a way to archive their news. Any way to do that?


Administrator, 690 Posts

9 August 2007 at 3:37pm

The easier is to create a different page called "news archive", and get your client to drag the old pages into that.

If you want to do it automatically, you could write a different Children() method on your news page that only listed the 10 most recent items, and an ArchiveChildren() method that will return older items:

function Children() {
  // return the current items;
function ArchiveChildren() {
  // return archived items

function archive() {
  return array(
    "Children" => $this->ArchiveChildren(),

That way, you have two URLs:
* - the news
* - the news archive.

What happens is this:
* When you visit news/archive, it uses the archive action to visit the news page
* This means that the archive() method gets called on the controller object.
* Since it returns an array, this is interpreted as being changes to the controller data. In this case, we've provided new data for <% control Children %>

You can also, if you want, make a new template called (classname)


43 Posts

14 April 2008 at 9:52am

Hi Sam,

I'm trying to achieve the same thing.
Do those two methods need to be placed in the in the ArticleHolder class?
I copy/pasted them in there, but I'm having a hard time getting it to work.
Also, how do I specify only displaying the five most recent articles?