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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

Event calendar Q #1


Go to End


5 Posts   1596 Views

Avatar
Funktion

Community Member, 10 Posts

4 September 2009 at 10:51pm

Hi there, im new to SS,

My first question is about the event_calendar module.

I want to "grey out" (that is, disable) all dates that have passed, ie. all dates prior to the current date.

Even finding the current date is difficult, forgive me if im obtuse, but i need help.

More Questions to come, thanks for the help with my project.

FunK

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 September 2009 at 1:49am

in your mysite/templates/layout/calendar.ss, just evaluate whether the date is in the past.

<% if StartDate.InPast %>class="past"<% end_if %>

Avatar
Funktion

Community Member, 10 Posts

5 September 2009 at 2:20am

Thank you so much for a quick response,

Still not sure on how to implement this, will it work to disable all past dates??

Where in calendar.ss do i add the code?

Sorry to be stupid :) :)

Thanks,

FunK

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 September 2009 at 2:54am

Well you just want them greyed out, right? You don't want them hidden.

The first thing you need to do is copy the contents of event_calendar/templates/Layout/Calendar.ss and CalendarEvent.ss to your mysite (or theme dir) /templates/Layout. Silverstripe always looks in your theme directory first for a template and falls back on the module default if it's not there.

Run a flush, and then in your Events control you could just do something like this:

<h3 class="summary"><% if Announcement %>$EventTitle<% else_if StartDate.InPast %><span class="past">$EventTitle</span><% else %><a href="$Link">$EventTitle</a><% end_if %></h3>

Avatar
Funktion

Community Member, 10 Posts

5 September 2009 at 7:13pm

Works like a charm, thankyou so much.