iCalendar - .ics file generation with CMSms

Thu. 27. October 2011 Snippets Jonathan Schmid
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}


Article was created by Jonathan Schmid

Jonathan Schmid

As a freelance front-end web developer the young autodidact has been working with cms made simple for over 4 years, creating a bunch of modules along the way. On his website he publishes articles on this and other topics concerning web development in German. You should follow him on Twitter.

Visit Jonathan Schmid's Website


  • Twitter
  • LinkedIn
« Back to Articles

Comments

Categories

Archive

From Twitter

I love CMSMS

Designed and developed by idea arts. I do this! © Copyright 2010-2013

Go back to Top