10447 Posts in 2223 Topics by 1719 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 265 Views |
-
Event Calendar Module - Upcoming Events from Multiple Calendars

17 July 2012 at 4:34pm
Hello
I have three event calendars on my site and I would like to display the upcoming events on the home page. The problem is, I can only get it to display events from my first calendar (but the calendar I want to use on the home page is not the first one).
I have tried in the template using
<% control UpcomingEvents(5, 'calendar') %>
and also<% control UpcomingEvents(5, calendar) %>
where my URLSegment is calendar, but it is still getting the events from the first calendar in the database.
Can anyone please help me with how I get it to show a different calendar?
Thank you
Vicki -
Re: Event Calendar Module - Upcoming Events from Multiple Calendars

18 July 2012 at 2:30pm
in case anyone else is trying to work this out I wound up changing the upcomingEvents function called from my HomePage.php (mysite/code/HomePage.php) from:
function UpcomingEvents() {
return DataObject::get_one("Calendar")->upcomingEvents(5);
}
tofunction UpcomingEvents() {
return DataObject::get_one("Calendar", "URLSegment = 'calendar'")->upcomingEvents(5);
}If anyone has a better solution i would love to hear it as obviously if my client changes the URL this will no longer work.
| 265 Views | ||
|
Page:
1
|
Go to Top |

