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.

All other Modules /

Discuss all other Modules here.

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

Calendar events on homepage not showing today's ICS events

Go to End

2 Posts   1538 Views


Community Member, 10 Posts

6 January 2010 at 10:33am


I have successfully gotten my calendar events to display on the home page with this code in my HomePage controller:

public function UpcomingEvents() {
        return DataObject::get_one("Calendar")->upcomingEvents();

The problem is ICS events scheduled for TODAY won't show up, even though they display as expected on the calendar page. All the other events work fine too.
Any help would be appreciated. Thanks!


Community Member, 10 Posts

8 January 2010 at 11:25am

Edited: 08/01/2010 11:28am

Okay, I figured this one out myself. It only took me 3 days!

In my HomePage_Controller class in mysite/code/HomePage.php I put the function

public function Events() {
  $today = date("Y-m-d");  
  return DataObject::get_one("Calendar")->Events(null, $today, null, false, 5, null);

Then in my templates/Layout/ file:

<% control Events %>
<% end_control %> 

The trick was to pass today's date to the Calendar class' function, because for some reason it was not getting the correct date for today to read the ICS feeds.
I hope this helps somebody!