10387 Posts in 2198 Topics by 1712 members
| Go to End | Next > | |
| Author | Topic: | 2171 Views |
-
Event Calendar - Upcoming Events Control

8 June 2010 at 1:48am Last edited: 8 June 2010 1:49am
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?
-
Re: Event Calendar - Upcoming Events Control

8 June 2010 at 1:54am
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.
-
Re: Event Calendar - Upcoming Events Control

8 June 2010 at 2:03am
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
-
Re: Event Calendar - Upcoming Events Control

8 June 2010 at 2:27am
Getting some page errors with <% control UpcomingEvents(4, 'events') %> and <% control UpcomingEvents(4, events) %>
-
Re: Event Calendar - Upcoming Events Control

8 June 2010 at 3:21am
What does "getting some errors" mean?
-
Re: Event Calendar - Upcoming Events Control

8 June 2010 at 8:17am Last edited: 8 June 2010 8:23am
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
-
Re: Event Calendar - Upcoming Events Control

8 June 2010 at 8:24am Last edited: 8 June 2010 8:25am
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.
-
Re: Event Calendar - Upcoming Events Control

8 June 2010 at 11:40am Last edited: 8 June 2010 11:41am
?showtemplate=1 didn't change anything =/ i'll see if i can find further context for you
| 2171 Views | ||
| Go to Top | Next > |

