Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Feeding a Google Calendar into a page


Reply


7 Posts   2027 Views

Avatar
pixelstuff

Community Member, 8 Posts

25 April 2009 at 9:23am

Edited: 25/04/2009 9:26am

I was wondering if it's possible to display a Google Calendar feed on a calendar grid in a SilverStripe site.

I am coming from the MODx CMS where they have a Google Events snippet that uses SimplePie to reformat the XML feed into the necessary HTML for a calendar table or just about any other markup you want.

An example of it is here http://test.ebenezerbaptist.com in the "Upcoming Events" sidebar container. I used jQuery to display the events one at a time. The snippet also has a preset calendar table that can be used for a full sized month view (which I haven't styled and therefore haven't embeded yet).

Does anyone know if something similar can already be done, if not does anyone want to work on something that will do this? Either a new module or perhaps modifying the current Event Calendar module to accept Google Calendar feeds.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

26 April 2009 at 1:44pm

Edited: 26/04/2009 1:46pm

Hi, pixelstuff,

The current development effort in the EventCalendar project is to add this feature, so you're in luck. It will also accept one-time imports of ICS files for those who are migrating calendars. So stay tuned!

The hard part has been finding a reliable ICS parser for PHP. Anything you could send my way would certainly help out a lot.

Avatar
pixelstuff

Community Member, 8 Posts

26 April 2009 at 3:57pm

Edited: 26/04/2009 4:27pm

You said a reliable parser. What have you tried already?

For example could the iCal parser in PHP iCalendar not be integrated?

Avatar
UncleCheese

Forum Moderator, 4096 Posts

30 April 2009 at 2:25am

PHP iCalendar does not use a standalone parser. When I took a look at it, it had a bunch of different contingencies and it just didn't look like anything modular that I could port over to the EventCalendar. I've also looked at ICSReader, but the problem is it splits the file into lines, so events with multi-line descriptions break, because it thinks everything after the first line of that description is a new property. I've tried rewriting the regex, but it's way beyond me.

Any help you could offer would be appreciated!

Avatar
pixelstuff

Community Member, 8 Posts

30 April 2009 at 3:23am

Edited: 30/04/2009 3:26am

Would the information here help you?
http://developer.apple.com/internet/appleapplications/icalendarfiles.html

The page discusses php and pearl methods for parsing.

I also came across this discussion on the parser for phpiCalendar. It is discussing plans for v3.0 I think.
http://phpicalendar.net/forums/viewtopic.php?f=58&t=2041

Avatar
UncleCheese

Forum Moderator, 4096 Posts

30 April 2009 at 3:28am

Great! Thank you! I must have an old version of PHP iCalendar.

I like this comment on the Parser class:

"please be careful with the explode with spezial characters. a ":" or ";" may also occure in the DESCRIPTION: part."

EXACTLY!!

Avatar
pixelstuff

Community Member, 8 Posts

30 April 2009 at 4:01am

Something else that looked interesting.
http://www.kigkonsult.se/iCalcreator/