Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » Sorting Future Posts

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 444 Views
  • shluckey
    Community Member
    19 Posts

    Sorting Future Posts Link to this post

    2.4.7 > Hi I'm using the parent-child structure to create a calendar that takes events specified by the user. So I have a calendar holder and then child calendar events. However my difficulty is only showing posts that are close to the current date as the user will input all events in one sitting thus causing my current function to only display the first 3 or last 3 events - dynamically that is showing 3 posts that are in the future from now. These posts will then change in a months time to the other events that are in the future. is it possible to use strtotime('now') and this function, replacing "StartDate ASC" with the current date and displaying future events relevant to today.

    function LatestEvents($num=1) {
       $news = DataObject::get_one("CalendarHolder");
       return ($news) ? DataObject::get("CalendarEntry", "ParentID > 0", "StartDate ASC", "", $num) : false;

    Any help is much appreciated

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.