Drupal 7: Installing and Configuring Date iCal to work with Events
First let’s start by downloading and installing the module: Date iCal
I did this using drush, but you can do it anyway to please.
Now, with the version I was using (7.x-1.1) the timezone handling wasn’t working properly so I applied this patch to correct timezone handling.
Hopefully that get’s permanently fixed in the module soon, and you won’t have to apply the patch anymore.
Next, we need to configure the content type that we want to use the iCal settings.
I all ready have a content type setup with a date field, called “Events”. If you don’t have one, then you’re going to have to create one.
Then go to the display settings, and turn on “iCal”
Click “Save” and then you need to choose what you want to show up in the iCal file description. Here is what mine looks like, don’t pay too much attention to this part or how mine differs from yours, I have this setup for different display settings in “Default” display.
Next we are going to add the view functionality in to generate our iCal files. Create a new view or choose an existing one, and add a “Feeds” section.
First let’s change the path since Views will complain about it with a message, “Display “Feed” uses a path but the path is undefined.”
Change the path option to be calendar/ical/%/calendar.ics
then change the Contexual Filter to be Content: Nid
Should look something like this:
Almost there, just need a couple more settings.
Under the heading Format we need to change RSS Feed to Date iCal Feed
Press Apply and you an leave the settings black or put in what you like.
Next you need to change the Show part, and change it from Content to Date iCal Entities
Click Apply, then you need to chose the field that contains your date information.
Click apply, save your view, and you are ready to get iCal files for your events.
To test your iCal files, get a node ID for an event you have created and then go to the URL http://example.com/calendar/ical/%/calendar.ics except you need to replace example.com with your site, and % with the node ID (nid).
You can integrate this into your theme template files with some code like this.
$nodeid = $node->id;
<a href=”http://example.com/calendar/ical/<?php echo $nodeid; ?>/calendar.ics”>Add to your calendar</a>