10390 Posts in 2201 Topics by 1712 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 441 Views |
-
Event Calendar - error when trying to list all events sorted by start date

4 May 2011 at 6:58am Last edited: 4 May 2011 7:00am
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.
-
Re: Event Calendar - error when trying to list all events sorted by start date

4 May 2011 at 7:17am
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;
| 441 Views | ||
|
Page:
1
|
Go to Top |

