Hi there
I’ve got a channel of events, and am trying to add a button next to each entry so users can download it to their calendar.
I’ve created a template to generate the ics file. It works fine in Safari but other browsers don’t seem to recognise it as an ics file and just open it as text in the browser. I suspect the problem may be to do with the mime type, but the php at the top doesn’t seem to help (and Safari opens it as ics correctly with our without the php).
I have my template type set to Web. Other types, including xml, just generate errors.
Here’s the template code, though I don’t think that in itself is the problem. In fact I’ve tried pasting in static ics code, which I know works on another site, and still get same issue - ok in Safari but not in anything else.
<?php
header ("Content-Type: text/Calendar");
header ("Content-Disposition: inline; filename=iCalendar.ics");
?>
BEGIN:VCALENDAR
X-WR-TIMEZONE:Europe/London
PRODID:-//False Economy//NONSGML v1.0//EN
CALSCALE:GREGORIAN
X-WR-CALNAME:False Economy
VERSION:2.0
{exp:channel:entries channel="events" show_future_entries="yes" disable="member_data|pagination|categories" limit="1"}BEGIN:VEVENT
UID:{entry_id}-falseeconomy
URL;VALUE=URI:http://falseeconomy.org.uk/campaigns/event/{url_title}
DTSTAMP:{entry_date format="%Y%m%dT%H%i%sZ"}
DTSTART:{entry_date format="%Y%m%dT%H%i%sZ"}
DTEND:{entry_date format="%Y%m%dT%H%i%sZ"}
LOCATION:{evestreet1}, {evetown} {evepost1} {evepost2}
SUMMARY:{title}
DESCRIPTION:{exp:tagstripper:stripAllTags}{evetext}{/exp:tagstripper:stripAllTags}
END:VEVENT{/exp:channel:entries}
END:VCALENDARAny advice would be very welcome.