Plugin

Archived
Forum
(read-only)


For official support, visit the official support site »

Easy iCalendar

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Exp:resso

     

iCal not reading ics file.

General

pixelpie
pixelpie

Hi there!
I’m getting an error when trying to open the file with iCal.
It says “iCal can’t read this Calendar file”.
The downloaded file doesn’t have extension by default, but if I add the extension it doesn’t work either.

The code in the template is:

{exp:easy_ical:calendar timezone="Australia/Melbourne" name="events"}
    {exp
:channel:entries channel="events" status="open|Featured" show_future_entries="yes" show_expired="no" disable="member_data|comments|pagination" limit="20"}
        {exp
:easy_ical:event uid="{entry_id}" start_time="{entry_date}" end_time="{expiration_date}" location="{event_venue}" summary="{title}"}
            {title_permalink
="event/view"}
        {
/exp:easy_ical:event}
    {
/exp:channel:entries}
{
/exp:easy_ical:calendar} 

And the ICS file that i get:

BEGIN:VCALENDAR
VERSION
:2.0
X
-WR-TIMEZONE:Australia/Melbourne
PRODID
:-//ExpressionEngine Easy iCalendar plugin//NONSGML v1.1//EN\r\nMETHOD:PUBLISH\r\nBEGIN:VEVENT
UID:13
LOCATION
:146A Elgin StCarlton Victoria
DTSTAMP
:20110606T000000
DTSTART
:20110606T000000
DTEND
:20110606T235900
SUMMARY
:June Event
DESCRIPTION
:http://localhost/spainculture/event/view/june_event
END:VEVENT
END
:VCALENDAR 

I tried to add some extra header parameter as “header(‘Content-Disposition: inline; filename=calendar.ics’);” but no luck either..

Am I missing something?


Thanks,
Albert

Exp:resso
# 1
Developer
Exp:resso

Hi Albert

Sorry for the slow response. I can’t see anything specifically which would be causing that, you shouldn’t need to add an extra header parameter or anything. Have you tried saving the file to your computer and then opening it with iCal from there?

If you want to add an extension to the download, the easiest way is just to add an extra segment when you link to it. For example

<a href="{path='group/template/event_url_title/event.ics'}">Download ICS</a

Cheers
Adrian

pixelpie
# 2
pixelpie

Thanks Adrian,
I’ve been doing some tests to try to figure out why iCal wasn’t reading the format and I ended up finding out that changing the order of a couple of parameters it’s reading it all right.

I’m not sure if it’s an issue of my iCal version (4.04) but it’s reading it at the moment.
The params order that are working for me are like:

BEGIN:VCALENDAR
PRODID
:-//ExpressionEngine Easy iCalendar plugin//NONSGML v1.1//EN
VERSION:2.0
METHOD
:PUBLISH
X
-WR-TIMEZONE:Pacific/Auckland
BEGIN
:VEVENT 

instead of

BEGIN:VCALENDAR
VERSION
:2.0
X
-WR-TIMEZONE:Pacific/Auckland
PRODID
:-//ExpressionEngine Easy iCalendar plugin//NONSGML v1.1//EN
METHOD:PUBLISH 

Do you know if this makes any sense for iCal to read the file?

Also I’m saving now the file as you recommended it and works sweet.

Thanks a lot Adrian.


Regards,
Albert

Exp:resso
# 3
Developer
Exp:resso

I don’t know much about ical in particular, just that most iCal programs seemed to be super fussy, which is why I developed the plugin in the first place (just spitting out iCal stuff in templates never worked very well).

I’m confused though - how are you changing the order of the generated ical file? Is that what the easy ical plugin is creating, or are you doing it manually? Our plugin will always put Version: 2.0 on the second line, before the PRODID etc.

Cheers
Adrian

pixelpie
# 4
pixelpie

I just exported an .ics file created in iCal and that was working if I imported it back to iCal. So i checked what was the difference between the file generated with your plugin and the iCal file.

After a few tries I realized that changing the order of those parameters it was working with the plugin generated file as well, so I changed the plugin source file to write those parameters first and that worked for me.

I am not sure if it is only because the iCal version that I’m using that needed the file to be populated in that order, because I’m sure that the plugin worked fine for you.

I’ll try to test it in other computers and I’ll let you know.


Cheers,
Albert.

Exp:resso
# 5
Developer
Exp:resso

Interesting. Looks like I’ve got the same version of iCal and don’t get any errors. Could you try editing your file so that it starts off in this order:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ExpressionEngine Easy iCalendar plugin//NONSGML v1.1//EN
X-WR-TIMEZONE:Pacific/Auckland

so version is still second, but prodid comes before the timezone?

If it accepts that, I’ll publish a new version with the fix.

Interestingly, the Apple developer docs have them all out of order and don’t mention anything about a required order: http://developer.apple.com/internet/appleapplications/icalendarfiles.html

Thanks
Adrian

pixelpie
# 6
pixelpie

Hi Adrian,
I did try having the version as the second parameter as you said and it worked fine.

I don’t know why my iCal is that picky with the order having the same version than you. I checked around but didn’t find any info about needing of a specific order for the ics file either, but the plugin just worked for me when I changed the order of the output parameters.

Anyway, thanks heaps for the plugin and for your help!!
Albert.

Exp:resso
# 7
Developer
Exp:resso

I’ve pushed a new version 1.1.1 to github - https://github.com/crescendo/easy_ical

Could you confirm that this fixes the problem? Not sure why it only happens for your version, but the whole point of this plugin is to be as compatible as possible, so will be good to fix it!

Cheers
Adrian

pixelpie
# 8
pixelpie

Hi Adrian,
I just tried and it works perfect.

I also downloaded again the version 1.1 to check and it didn’t worked, so has to be something with the order of parameters for sure because version 1.1.1 worked like a charm.


Thanks for that,
Albert.

Exp:resso
# 9
Developer
Exp:resso

Great news :)

Glad it’s fixed.

Adrian