Hi,
I try to do multiple news consisting of News, "NewsPage" and the news "DiscographyNews".
I would like to be displayed by date.
At the moment I found such a thing
function LatestNews($num=10) {
return DataObject::get("ArticlePage", "", "Date DESC", "", $num);
}
Everything is good because it displays each note of the layout Articlepage (anywhere I would not put it)
When I try insert this code:
function LatestNews($num=10) {
return DataObject::get("DiscographyPage", "", "Date DESC", "", $num);
}
displays all DiscographyPage
I would like to combine it into one to sort by date and display all at once on the home page
I tried this:
function LatestNews($num=10) {
return DataObject::get("ArticlePage", "", "Date DESC", "", $num);
return DataObject::get("DiscographyPage", "", "Date DESC", "", $num);
}
But then retrieves only the first "return".
It can be somehow unite?
I find that but this not sort by date
function LatestNews($num=15) {
$articles = DataObject::get("ArticlePage", "", "Date DESC", "", $num);
$disc = DataObject::get("DiscographyPage", "", "Date DESC", "", $num);
$articles->merge($disc);
return $articles->getRange(0, $num);
}
Struck-out text because: See post below
Sorry for my bad English