iCalendar - .ics file generation with CMSms

The iCalendar file format is the de facto standard for sharing event dates. Thus you'll be well advised to offer your website users an iCalendar file for every event to enable them putting it directly into their calendar - as it may be an outlook calendar or iCal or whatever.

Goran Ilic created a manageable CMSms plugin to handle this called iCalendar. Just put the plugin tag into your CGCalendar template and it'll generate an .ics file for you and echo a download link.

Here's an example how to use it within your event template:

{ics subject=$event.event_title start=$event.event_date_start end=$event.event_date_end summary=$event.event_summary detail=$event.event_details}

Unhappily Apple's mobile devices that aren't updated to iOS5 yet, are in need of the webcal protocol to handle ics files. So the following code combined with the browsertools plugin will put things right:

{ics subject=$event.event_title start=$event.event_date_start end=$event.event_date_end summary=$event.event_summary detail=$event.event_details assign="ics"}
{if …} {* check if it's an iPad / iPhone / iPod *}
<a href="{$ics|replace:'http://':'webcal://'}">Add this event</a>
{/if}

Comments