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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Latest News


Reply


4 Posts   1152 Views

Avatar
corkg

Community Member, 30 Posts

25 March 2009 at 6:32am

Why does the tutorial for how to get latest news on the homepage not work?

function LatestNews($num=5) {
$news = DataObject::get_one("ArticleHolder");
return ($news) ? DataObject::get("ArticlePage", "ParentID = '$news->ID'", "Date DESC", "", $num) : false;
}

Avatar
Double-A-Ron

Community Member, 604 Posts

25 March 2009 at 5:30pm

It would help if you told everyone what it is doing wrong or even better, what error is being displayed.

Cheers
Aaron

Avatar
GeorgeCrawford

Community Member, 8 Posts

18 February 2010 at 9:47pm

Hi all,

I am having problems with the latest new tut.

I have gone through the tut, but when I go to the homepage of the site get an error about the SQL query....

[User Error] Couldn't run query: SELECT `SiteTree_Live`.*, `Page_Live`.*, `SiteTree_Live`.ID, if(`SiteTree_Live`.ClassName,`SiteTree_Live`.ClassName,'SiteTree') AS RecordClassName FROM `SiteTree_Live` LEFT JOIN `Page_Live` ON `Page_Live`.ID = `SiteTree_Live`.ID WHERE (ParentID = 18) AND (`SiteTree_Live`.ClassName IN ('ArticlePage')) ORDER BY Date DESC LIMIT 5 Unknown column 'Date' in 'order clause'

Any ideas would be gratefully received!

Avatar
GeorgeCrawford

Community Member, 8 Posts

18 February 2010 at 9:55pm

Fixed it!

It was trying to order by date, which I didn't have in the db.