1770 Posts in 495 Topics by 531 members
Blog Module
SilverStripe Forums » Blog Module » BlogTree entries on homepage?
Discuss the Blog Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 563 Views |
-
BlogTree entries on homepage?

14 October 2010 at 1:48am
Hello,
I have set four main menu items as Blogtree page type, and under each blog tree I have other blogholders. I'm looking for a way to show the latest entries on the homepage exactly the same as what you see on blogTree page.
I was trying something like the following but it returned only entries from first blogHolder:
function LatestNews($id) {
$news = DataObject::get_one('BlogTree', "ParentID = $id");
return ($news) ? DataObject::get("BlogEntry", "ParentID = $news->ID", "Date DESC", "", 1) : false;
}I would appreciate any help.. thanks
-
Re: BlogTree entries on homepage?

28 October 2010 at 7:12pm
If you are trying to use <% control LatestNews($id) %> it won't work as the template engine doesn't support passing variables into functions.
One way if you want all the blog entries on the homepage is simply to use
function LatestNews() {
return DataObject::get("BlogEntry","", "Date DESC", "", 5);
}To return the latest blog entries from anywhere.
| 563 Views | ||
|
Page:
1
|
Go to Top |


