I have defined NewsHolder and NewsPage classes as instructed in the SilverStripe Tuts. Now, I have page 1 of type NewsHolder and subpage 11, subpage 12, ... of type NewsPage under it. I also have page 2 of type NewsHolder and subpage 21, subpage 22, ... of type NewsPage under that. In the sitemap, Page 1 appears above Page 2.
Now, I have defined the following function in NewsHolder.php
function NewsArchive() {
$news = DataObject::get_one("NewsHolder");
return ($news) ? DataObject::get("NewsPage", "ParentID = $news->ID", "Date DESC") : false;
}
In my templates, this function correctly lists the news items under Page 1, but on Page 2, the news list returned is that of Page 1. The function only selects the first instance of NewsHolder in the sitemap. How can I use class NewsHolder for multiple pages and correctly generate the chronological list of NewsPage pages under each NewsHolder page?