Jump to:

23545 Posts in 19310 Topics by 2888 members

General Questions

SilverStripe Forums » General Questions » Latest News

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

Page: 1
Go to End
Author Topic: 1100 Views
  • corkg
    Avatar
    Community Member
    30 Posts

    Latest News Link to this post

    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;
    }

  • Double-A-Ron
    Avatar
    Community Member
    604 Posts

    Re: Latest News Link to this post

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

    Cheers
    Aaron

  • GeorgeCrawford
    Avatar
    Community Member
    8 Posts

    Re: Latest News Link to this post

    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!

  • GeorgeCrawford
    Avatar
    Community Member
    8 Posts

    Re: Latest News Link to this post

    Fixed it!

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

    1100 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.