10448 Posts in 2223 Topics by 1719 members
| Go to End | Next > | |
| Author | Topic: | 1335 Views |
-
Event Calendar Module - How to Question

28 June 2011 at 9:41am
Is there a way to show the next two events on another page besides the main events page? I have a space on my home page for upcoming events and if possible I'd like this to show the next two events as opposed to me having to update that page manually myself. Is there a way to do this?
I'm not a developer, so writing scripts isn't an option for me. I'm just wondering if there is a fairly simple way to achieve this. Any help you can provide is greatly appreciated.
-
Re: Event Calendar Module - How to Question

28 June 2011 at 4:55pm
Hi UncleCheese,
I have a similar problem. I can get the next upcoming event to show, however when I added 2 more calendars to my site, it isn't showing the next upcoming event anymore. This is my function code:
return DataObject::get_one("Calendar")->upcomingEvents(1);
How can I specify a parent ID to the above?
I tried this:
$event = DataObject::get_one("Calendar");
return ($event) ? DataObject::get("CalendarEvent", "ParentID=16", "", "", 1) : false;But it shows past events.
Any help would be greatly appreciated.
Cheers,
Ben -
Re: Event Calendar Module - How to Question

29 June 2011 at 8:23am
I think I'm still missing what to do with that line of code. I added it in but it isn't working and the WYSIWYG Editor actually strips out the "<" and ">". What am I doing wrong?
<td width="290px">
<h2>News & Events</h2>
<table id="News & Events Table" style="width: 100%;" border="0">
<tbody>
<tr valign="top">
<td><% control UpcomingEvents %></td>
</tr>
<tr valign="top">
<td>
<p><a class="link" href="[sitetree_link id=16]">view other events</a></p>
</td>
</tr>
</tbody>
</table>
</td> -
Re: Event Calendar Module - How to Question

29 June 2011 at 12:21pm
You need to add it to your Page.SS file (or whichever page type it is).
-
Re: Event Calendar Module - How to Question

29 June 2011 at 12:37pm
Thanks, so there is no way to have it just on that one page? I don't want it everywhere there is a cell in a table that is supposed to show the next two events that appears only on the home page.
-
Re: Event Calendar Module - How to Question

29 June 2011 at 12:43pm
Yes, you could either create a new template for the home page. See: http://doc.silverstripe.org/sapphire/en/tutorials/1-building-a-basic-site
Or you could put an if statement, like this:
<% if Page(home) %>
<table id="News & Events Table" style="width: 100%;" border="0">
<tbody>
<% control UpcomingEvents %>
<tr>
<td>$Event.CalendarEventImage
<h3><a href="$Event.Link">$Event.Title</a></h3>
<h4>$_Dates</h4>
$Event.Content</td>
</tr>
<% end_control %>
</tbody>
</table>
<% end_if %>The above is untested...
-
Re: Event Calendar Module - How to Question

29 June 2011 at 3:25pm
Its much better to make a custom page type. If you're putting structural markup in the wysiwyg editor, you've really missed the whole point of silverstripe, and you need to read the tutorial above.
| 1335 Views | ||
| Go to Top | Next > |


