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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

event calendar - listing upcoming events


Go to End


2 Posts   724 Views

Avatar
thomas.paulson

Community Member, 107 Posts

22 January 2014 at 1:29am

Edited: 22/01/2014 1:30am

I am trying to listing upcoming events in footer.ss file. Below is code i am using, Unfortunately it list only recurring CalendarEvent,

/**
* Class EventsControllerExtension
*/
class EventsControllerExtension extends Extension
{
/**
* @param $limit
* @return mixed
*/

public function MyUpcomingEvents($limit){
//Debug::show(Calendar::get()->first()->UpcomingEvents($limit));
return Calendar::get()->First()->UpcomingEvents($limit);
}

}

-- config.php --
--------------------------------

if (class_exists('ContentController')) {
Object::add_extension('ContentController', 'EventsControllerExtension');
}

--- footer.ss ---------
------------------------

<ul>
<% loop $MyUpcomingEvents(2) %>

<li>
<h5>
<a href="$Link" title"$Title">$Title - $StartDate</a>
</h5>
$Content.FirstParagraph
</li>

<% end_loop %>

</ul>

Could somehelp me to list both non-recurring and recurring events.

Avatar
thomas.paulson

Community Member, 107 Posts

24 January 2014 at 4:21pm

Edited: 26/01/2014 4:32pm

oops, i have not set end date for the non recurring events. :D

Events are listing in footer now. Thanks Uncle Cheese for calendar event.