Page 1 of 1

CGCalendar + ical feed

Posted: Mon May 09, 2016 8:05 pm
by hasanen
I tried to search if it would be possible to subscribe CGCalendar events somehow, but I couldn't find any solution. So I ended up doing it with templates.

1. Create a template of type "CGCalendar::Event List View" and paste following code to it

Code: Select all

{assign date_format "%Y%m%dT%H%M%S"}
BEGIN:VCALENDAR
VERSION:2.0
PRODID:set some id in here
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:CGCalendar feed
{foreach from=$events key=key item=event}
BEGIN:VEVENT
DTSTAMP:{$event.event_date_start|date_format:$date_format}Z
UID:my_event_{$event.event_id}
DTSTART:{$event.event_date_start|date_format:$date_format}
{if $event.event_date_end}
DTEND:{$event.event_date_end|date_format:$date_format}
{/if}
CREATED:{$event.event_create_date|date_format:$date_format}
LAST-MODIFIED:{$event.event_modified_date|date_format:$date_format}
SUMMARY:{$event.event_title} 
END:VEVENT
{/foreach}
END:VCALENDAR
2. Create an empty template of type "Core::Page" with just code

Code: Select all

{content}
3. Create a page that is not shown in menu and is using your empty template. Disable WYSIWYG from that page and use code similar to this

Code: Select all

{cms_module module="CGCalendar" display="list" listtemplate="name of template created on step 1"}
4. You can set custom url for the page, e.g. "events.ics" and start sharing that link.

Quick and dirty, but it works :)

Re: CGCalendar + ical feed

Posted: Tue May 10, 2016 2:42 pm
by velden
Thanks for sharing!

I'm not sure whether the DTSTAMP is used properly.

Further I think DTSTART end DTEND should contain time zone information. Though it might seem to work when only used by locals (people in the same time zone). When sharing event information across time zones I expect current implementation to fail.

Re: CGCalendar + ical feed

Posted: Fri May 13, 2016 5:51 am
by hasanen
velden wrote: I'm not sure whether the DTSTAMP is used properly.

Further I think DTSTART end DTEND should contain time zone information. Though it might seem to work when only used by locals (people in the same time zone). When sharing event information across time zones I expect current implementation to fail.
You might be correct, I'm not too familiar with the specs and I pretty much copied this from google's feed. All fixes and improvements are very welcome :)