Just want to say thanks! This thread helped me through merging two child pages into one 'holder page', appreciate the info.
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.
Go to End
- Previous 10 entries
- 1
- Page 22(current)
Can anyone help. I would like to limit my results.
$numlimit = 10;
$numlimit = $this->LatestDocCount;
$ds = new DataObjectSet();
$ds->merge(DataObject::get("SiteTree", "ClassName = 'Download' AND Created > DATE_SUB(NOW(),INTERVAL 14 DAY) OR ClassName = 'Download' AND LastEdited > DATE_SUB(NOW(),INTERVAL 14 DAY)", "Created DESC, LastEdited DESC", ""));
$ds->merge(DataObject::get("DocumentResource", "Created > DATE_SUB(NOW(),INTERVAL 14 DAY) OR LastEdited > DATE_SUB(NOW(),INTERVAL 14 DAY)", "PageID, Created DESC, LastEdited DESC", ""));
$ds->sort('LastEdited', 'DESC' );
return $ds
SOLUTION this worked for me
public function LatestDocuments() {
$numlimit = 10;
$numlimit = $this->LatestDocCount;
$ds = new DataObjectSet();
$ds->merge(DataObject::get("SiteTree", "ClassName = 'Download' AND Created > DATE_SUB(NOW(),INTERVAL 14 DAY) OR ClassName = 'Download' AND LastEdited > DATE_SUB(NOW(),INTERVAL 14 DAY)", "Created DESC, LastEdited DESC", ""));
$ds->merge(DataObject::get("DocumentResource", "Created > DATE_SUB(NOW(),INTERVAL 14 DAY) OR LastEdited > DATE_SUB(NOW(),INTERVAL 14 DAY)", "PageID, Created DESC, LastEdited DESC", ""));
$ds->sort('LastEdited', 'DESC' );
//getRange
$records = $ds->getRange(0, $relimit);
return $records
}
Go to Top
- Previous 10 entries
- 1
- Page 22(current)