Jump to:

11004 Posts in 2735 Topics by 1824 members

All other Modules

SilverStripe Forums » All other Modules » event calendar - listing upcoming events

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 233 Views
  • thomas.paulson
    Avatar
    Community Member
    79 Posts

    event calendar - listing upcoming events Link to this post

    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.

  • thomas.paulson
    Avatar
    Community Member
    79 Posts

    Re: event calendar - listing upcoming events Link to this post

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

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

    233 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.