Jump to:

10844 Posts in 2515 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar - Upcoming Events Control

Discuss all other Modules here.

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

Page: 1 2 3
Go to End
Author Topic: 2653 Views
  • churika
    Avatar
    Community Member
    29 Posts

    Event Calendar - Upcoming Events Control Link to this post

    I've been trying to pull the next 4 upcoming events from a calendar on to a home page for a few weeks now to no avail using the predefined global UpcomingEvents control. I'm not understanding where and how to use this function or control and the times I've tried have pulled up no results. Anyone have any further information on how to use this function?

    Also, would I have access to the $_Dates function pulling them in through the control?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar - Upcoming Events Control Link to this post

    On any page, you can use the UpcomingEvents() function that is decorated on your SiteTree to pull in the upcoming events from your calendar, e.g.

    <ul>
    <% control UpcomingEvents(4) %>
    <li>$_Dates $EventTitle</li>
    <% end_control %>
    </ul>

    If you have multiple galleries, you'll have to pass the URLSegment of the gallery you want to use as the second argument.

  • churika
    Avatar
    Community Member
    29 Posts

    Re: Event Calendar - Upcoming Events Control Link to this post

    Ah ok, I have multiple galleries which probably explains why I wasn't getting any results.

    Passed like <% control UpcomingEvents(4, 'events') %>

    if the URL Segment of that calendar is /events

  • churika
    Avatar
    Community Member
    29 Posts

    Re: Event Calendar - Upcoming Events Control Link to this post

    Getting some page errors with <% control UpcomingEvents(4, 'events') %> and <% control UpcomingEvents(4, events) %>

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar - Upcoming Events Control Link to this post

    What does "getting some errors" mean?

  • churika
    Avatar
    Community Member
    29 Posts

    Re: Event Calendar - Upcoming Events Control Link to this post

    for

    <% control UpcomingEvents(4, 'events') %>

    it says "Parse error: syntax error, unexpected '}' in C:\Users\Nick\AppData\Local\Temp\silverstripe-cacheD--Web-xampp-htdocs\.cacheD..Web.xampp.htdocs.PJCBG.templates.HomePage.ss on line 232"

    and for

    <% control UpcomingEvents(4, events) %>

    it says "Fatal error: Call to a member function XML_val() on a non-object in C:\Users\Nick\AppData\Local\Temp\silverstripe-cacheD--Web-xampp-htdocs\.cacheD..Web.xampp.htdocs.PJCBG.templates.HomePage.ss on line 199"

    without any parameters or just 4 as a parameter it still says "Fatal error: Call to a member function XML_val() on a non-object in C:\Users\Nick\AppData\Local\Temp\silverstripe-cacheD--Web-xampp-htdocs\.cacheD..Web.xampp.htdocs.PJCBG.templates.HomePage.ss on line 199"

    and i forgot to mention that without the control there are no errors in the page

  • UncleCheese
    Avatar
    4085 Posts

    Re: Event Calendar - Upcoming Events Control Link to this post

    Well the first error is because you can't use quotes like that. The other error is unrelated to the control statement. You have an error within the control somewhere, but I can't tell you what it is without any context.

    Use ?showtemplate=1 in your URL to find the line it's referring to.

  • churika
    Avatar
    Community Member
    29 Posts

    Re: Event Calendar - Upcoming Events Control Link to this post

    ?showtemplate=1 didn't change anything =/ i'll see if i can find further context for you

    2653 Views
Page: 1 2 3
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.