Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » Event Calendar - error when trying to list all events sorted by start date

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 621 Views
  • ayyurek
    Avatar
    Community Member
    41 Posts

    Event Calendar - error when trying to list all events sorted by start date Link to this post

    I am having some problems about event calendar module. I hope someone can help

    I extended the Calendar class,

    class ExhibitionHolder extends Calendar
    {
       static $has_many = array (
          'ExhibitionPages' => 'ExhibitionPage'
       );
    }


    and,
    CalendarEvent class.

    class ExhibitionPage extends CalendarEvent
    {
       static $has_many = array (
    'ExhibitionDates' => 'ExhibitionDateTime'
       );
    }

    In the ExhibitionHolder.ss I want to list 5 upcoming events if there are no dates clicked.

    <% if Events %>
    <% control Events %>
    $_Dates $EventTitle $Link
    <% end_control %>
    <% else %>
    <% control ExhibitionList %>
    $Title <% control Dates %>$StartDate.Nice<% end_control %> <% control Dates %>$EndDate.Nice<% end_control %> $Link
    <% end_control %>
    <% end_if %>

    The following function returns the list of all Exhibition Pages as expected. But I when I try to sort them using StartDate. I get error. When I use ID in the join, I get error 'Column 'ID' in on clause is ambiguous'. When I use ExhibitionPage.ID, I get error 'Unknown Column ExhibitionPage.ID'.

    function ExhibitionList($num=5) {
       return DataObject::get("ExhibitionPage", "", "CalendarDateTime.StartDate ASC", "LEFT JOIN CalendarDateTime ON CalendarDateTime.EventID = ID", $num);
       }

    Any help will be great.

  • ayyurek
    Avatar
    Community Member
    41 Posts

    Re: Event Calendar - error when trying to list all events sorted by start date Link to this post

    Ok, it was an unnecessary problem. Events module shows the upcoming events by default, in the calendar home page. I couldn't see them because it's listing only events for upcoming 6 months. And I was having events for 2012. You can change 6 months to anything you want in the Calendar.php file line 41.

    static $defaultFutureMonths = 6;

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