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.

Data Model Questions /

[solved] ss 2.4.5 CaseStudy feed on home page only takes from first holder in site tree


Reply


4 Posts   432 Views

Avatar
neilos

Community Member, 19 Posts

4 June 2013 at 2:02am

Hi,

I'm sure this is a simple solution, but I have spent a long time on this and can't figure it out.

I have an old version (2.4.5) site that has a case studies section that feeds 2 most recent articles to home page.
At least it should, but it only feeds the case studies that are children of the first CasestudyHolder in the site tree.

How do I get it to list the two most recent CasestudyPage on the home page regardless of which CasestudyHolder they belong to?

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

Regards,
neilos

Avatar
neilos

Community Member, 19 Posts

12 June 2013 at 10:37pm

Has anyone had this problem before?

Avatar
Devlin

Community Member, 215 Posts

12 June 2013 at 11:35pm

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

Avatar
neilos

Community Member, 19 Posts

13 June 2013 at 12:54am

Thanks Devlin, that's the ticket!