Search code examples
silverstripefeed

silverstripe 2.4.5 Casestudy feed only taking from first category


I have asked this question on the SS forum, but haven't had a response as of yet - http://www.silverstripe.org/data-model-questions/show/23903

Basically I have a site that has a case studies section, the two most recent should feed on the home page. But it only gets feeds the case studies that are children of the first category.

Here is the code;

    function CaseStudy($num=2) {
$casestudy = DataObject::get_one("CasestudyHolder");
return ($casestudy) ? DataObject::get("CasestudyPage", "ParentID = $casestudy->ID", "Date DESC", "", $num) : false;
}

How do I get this to get all CasedtudyPage from all categories instead of the first one?

Many thanks.

Nez


Solution

  • Answer has been posted on SS forum on above link;

        function CaseStudy($num=2) {
         return DataObject::get("CasestudyPage", null, "Date DESC", "", $num);
        }