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, biapar, Willr, Ingo, swaiba, simon_w

event calendar - listing upcoming events


Reply


2 Posts   280 Views

Avatar
thomas.paulson

Community Member, 86 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, 86 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.