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.

Blog Module /

Discuss the Blog Module.

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

Sorting Future Posts

Go to End



Community Member, 19 Posts

4 April 2013 at 6:19am

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