Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

Pre-loading Calendar Events


Go to End


4 Posts   1178 Views

Avatar
sav_ss

Community Member, 11 Posts

12 January 2011 at 6:41pm

Would there be a way of scheduling events so that they dont appear on the website until after a specified date?

Thanks.

Avatar
sav_ss

Community Member, 11 Posts

13 January 2011 at 2:12pm

Sorry about asking for too much up front :\

I updated the CalendarEventClass

class CalendarEvent extends Page
{
	static $db = array (
		...
		'ActivationDate' => 'Date'
	);
}

I'm having problems finding out what the syntax would be to compare this field with the current date. I've narrowed it down to modifying Calendar.ss about here

...
<% if Events %>
	<div id="events">
		<% control Events %>

I thought of encapsulating the remainder of the control block into something like

<% if $ActivationDate < time() %>
...
<% end_if %>

It doesn't work. heh.
Can anyone tell me the correct syntax please?

Avatar
sav_ss

Community Member, 11 Posts

18 January 2011 at 12:33pm

Still trying to understand this code ...

In the file Calendar.php there's protected members $start_date and $end_date that appear global to the class. There's also a function 'Events' which the template file is 'control'-ing to display the list of event on the website. The function 'Events' takes a bunch of arguments, including the variables $start_date and $end_date. Why is that ? Are these new $start_date and $end_date variables?
Shouldn't the function 'Events' naturally have access to these variables ?

Regards,

Avatar
sav_ss

Community Member, 11 Posts

18 January 2011 at 5:05pm

Well, I've given up trying to accomplish the date activation that way.
Does anyone (apart from unclechee$e) know how to add another date to the Dates and Times tab of the CMS?

Regards,