Jump to:

10977 Posts in 2720 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » How to pull upcoming events but from one of two calendar

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 884 Views
  • otherjohn
    Avatar
    Community Member
    125 Posts

    How to pull upcoming events but from one of two calendar Link to this post

    Hi all,
    I have the event-calendar setup for regular calendar use. Then I created a module that is an extension of the event calendar that is for certain group meetings. This one is extended with event address, map, etc.

    On the homepage of the site, I would like to pull upcoming events, but only from the regular calendar. Not from the extended one.

    When I use the following code in my page.php file, it pulls back events from the extended calendar.

    public function UpcomingNonAnnouncements()
    {
    return DataObject::get_one("Calendar")->upcomingEvents(5);
    }

    Any idea how I can fix this?

  • UncleCheese
    Avatar
    4085 Posts

    Re: How to pull upcoming events but from one of two calendar Link to this post

    get_one("Calendar") is just going to select one arbitrarily. You need to add more criteria if you want to get a specific one.

    Keep in mind, the UpcomingEvents() function that is decorated into all SiteTree objects takes a URLSegment as a second argument..

    <% control UpcomingEvents(5,some-calendar) %>

  • DanStephenson
    Avatar
    Community Member
    115 Posts

    Re: How to pull upcoming events but from one of two calendar Link to this post

    Hi Uncle Cheese,

    Is there a way I can test for if there are any upcoming events in a calendar? Essentially I have a sidebar block on my homepage showing my latest events, incluidng a headline of Latest Events. If there are no events I want the whole block to not be displayed.

    884 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.