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}
Nice post really , Thanks for sharing.
I couldn’t have really asked for a much better blog. You are always at hand to provide excellent information, going straight away to the point for easy understanding of your subscribers. You’re really a terrific pro in this arena. Many thanks for remaining there humans like me.
I have just released a new version of iCalendar for CMSms. Changelog for 1.1: - implemented wecal protocol - export data directly from cgcalendar - improved help page - bug fixes
Oh - I forgot to mention that the tab characters which caused me the problem with importing into iCal on a Mac can easily be removed.
Edit line 72 of function.ics.php to remove the tab characters so the " (double quote) is the first character on that line.
All works as expected then. Many thanks for the function - a very useful addition to the CGCalender module.
Cheers, Chris
This seems an excellent idea!
But, you knew that there had to be one, when I try and import the file into iCal on a Mac it claims the file is unreadable. Investigation shows the file to be in the correct format but when I try and validate at http://severinghaus.org/projects/icv/ I see this:-
Your calendar is using an invalid newline format. Make sure to use \r\n to end lines rather than just \n (RFC 2445 §4.1).
If I manually adjust the line endings then it will still not import so that was not the problem. But along the way I noticed that there are four tab characters in the last line of the file. Of course you can not see these but removing them solves the problem.
Any chance of a fix to the function? Regards, Chris
Hey HH,
this will be added in the next version coming soon.
Cheers, Jonathan
Hello,
thanks for sharing the plugin. Works like a charm. I'ld like to ask if there's a way to make it output all the events in the calendar at once? So if there are 10 events the user need not got through the download/ import procedure 10 times but could do it in one action?
Thank you HH