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.

All other Modules /

Discuss all other Modules here.

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

Events Calendar alternative templates

Go to End

4 Posts   1041 Views


Community Member, 117 Posts

15 August 2011 at 4:42am

Can anyone give a me a pointer as to how I go about specifying alternative layouts based on overall calendar?

I have extended Calendar to add some custom functionality and so I have a custom template. Wnat I want to do is switch between using and depending on the calendar I'm using. I'm guessing I build a switch based on the overall calendar IR or maybe part of the URL?


Forum Moderator, 4102 Posts

16 August 2011 at 1:38am

Those templates are meant to be overridden. Just place a,, etc, in your theme Layout dir.

Silverstripe tips, tutorials, screencasts, and more.


Community Member, 117 Posts

16 August 2011 at 11:45am

Edited: 16/08/2011 11:48am

Thanks for the reply UC, but what I meant was how i could best rednder the calendar output to use alternative calendar templates depending on what calendart was being used i.e. i have more than one calendar on the website.

Anyway I've resolved my problem now by keeing the Calendar.css, but including some conditional includes to determine from calendar is being called (a bit dirty but I hard-coded condition to use using URLSegment)


Forum Moderator, 4102 Posts

19 August 2011 at 1:47am

Ah, yeah.. In SilverStripe it's one template per controller. So to show an alternate layout, between two pages that use the same controller, you have a couple options. If the changes are pretty simple and non-structural, you can class and id the body element.

<body class="$ClassName" id="$URLSegment">

If it's more complex, then subclass the two controllers


AlternateCalendar extends Calendar {}
AlternateCalendar_Controller extends Calendar_Controller {}


AlternateCalendarEvent extends CalendarEvent {}
AlternateCalendarEvent_Controller extends CalendarEvent_Controller {}

Of course, the naming pattern is up to you, but that will allow you to create and Just remember to change the page types in the Behaviour tab.

SilverStripe tips, tutorials, screencasts and more: