I would like to display news sorted by date instead of the order they are in the CMS.
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.
I'm assuming that you're using the News articles from the tutorial.
One way of doing this is to add your own method to the ArticleHolder in ArticleHolder.php, something like
function OrderedChildren() {
return DataObject::get('ArticlePage', 'ParentID = ' . $this->ID, 'Date DESC');
}
Then, in your template, instead of using <% control Children %>, you'll use <% control OrderedChildren %>
Thanks! Yes this was from the tutorial.