I had trouble finding a plugin for displaying Google Calendar events on a page, so I wrote a plugin based on the Twitter timeline plugin and SimplePie. There were a few Magpie-based attempts, but none of them suited my needs (in particular, being able to parse out start / end times, the location, and description fields, which Magpie was skipping because they’re unique to the Google feed).
At any rate, here’s what sample code may look like:
{exp:gcal gcal_id="bn44qj4p2l2usv6avn45v7lb28@group.calendar.google.com" from="February 10, 2007" show_future="true" sort_order="a" limit="5" refresh="120"} <ul> <li> {if description}<a href="{description}">{title}</a>{if:else}{title}{/if}<br /> from {start_time format="%Y-%m-%d %H:%i"} to {end_time format="%Y-%m-%d %H:%i"} <br/> location: {location} <br/> <a href="{link}">add to your calendar</a> </li> </ul> {/exp:gcal}
In addition to the plugin file (pi.gcal.php), you’ll also need to place the simplepie.inc file in the same location (included in the attached zip).
This is my first plugin, so I’m calling it 0.5 for now. There are a few outlier parameters Google accepts which I didn’t get around to implementing for now.
Hi,
I’ve been looking for a way to do this! I have output of all of my page elements except for what should be generated by the plugin. No errors in the debug. Does this work with the current version of EE?
Have you tried loading the gcal link in something else - either directly in the browser or subscribed via iCal? also make sure it’s a public calendar - currently this doesn’t support private ones.
Actually I just found it yesterday so I haven’t had the time yet. I’ll probably get to it by the middle of the this week. I’ll be sure to post my experience here.
Plugin works great for me. One request: could it be expanded to pull multiple calendar feeds (pipe-separated list) and then show all the COMBINED events?
I have it partially working. It’s pulling back information but it’s not displaying in the correct order. I’m getting results that go from 2008, to 2017, to 2009, to 2013, and back to 2008. Any ideas as to what I might have wrong?
I’m also having similar issues to ignite with the randomly-ordered stuff if I try to dynamically set start date for displaying cal entries. It seems to order OK if I manually put in a start date.
My repeating events are also not showing up, other than the first occurrences. If I can get those two things fixed, this is great!
Is there anyway one of you could explain this to me? I’ve implemented the code
{exp:gcal gcal_id="a4dllr27klnnfao1iv9qvltack@group.calendar.google.com" from="June 3, 2009" show_future="true" orderby="d" limit="5"} <ul> <li> {if description}<a href="{description}">{title}</a>{if:else}{title}{/if} <br /> from {start_time format="%Y-%m-%d %H:%i"} to {end_time format="%Y-%m-%d %H:%i"} <br/> location: {location} <br/> <a href="{link}">add to your calendar</a> </li> </ul> {/exp:gcal}
I’m a bit confused as to what the id actually is. I’ve grabbed it from my google calendar settings page but the events I have posted are not showing up.
From what I understand I drop the two files in the pi.gcal folder into my plugins folder and use the above code to call the plugin.
If I’m understanding this right I should not have to make a new template, that should be dynamically created by the php and inc file pulling the rss information from google.
thanks for that tip. I had to remove it too. I wish I could get the from and to attributes working though.
@all,
I’m also having the strange order problem and the repeating events not showing up right (i.e. the repeating event is weekly but the only one showing up is one from 2011! strange)
Also, the all day events are showing strange dates. i.e. if the date is Oct. 24 and all day is marked, it is showing the date as oct. 23 at 7pm to oct. 24 at 7pm.
The plug-in works great for me. I was wondering if someone knows how to paginate the results. I have numerous future events that I would like to limit to about 20 per page. Any Ideas. The pagination code does not work.
I would really love to be able to use this…I’ve been sitting forever tweeking “pi.gcal.php doc” trying to get the title and description to display something. I’m really not a php programmer. Date and description come up. Link is malformed.
A simplified version of this other script works fine on my server here, but I don’t understand all the caching code to make it work within an ee template.
Likely has nothing to do w/ it, but my error log (public root) says:
[16-Oct-2009 05:04:09] PHP Fatal error: Call to undefined method GCal::_curl_fetch() in /home/amystodd/public_html/dev/gsis/admin/plugins/pi.gcal.php on line 91
@ Paul J. I couldn’t get this plugin to work, so I went about it a different route. I used PHP to render XML that’s easier to step through. That XML gets imported to an EE weblog using BrandNewBox.co.uk’s XMLGrab plugin. I’ll post a full explanation of everything once its implemented.
I attached the PHP Script that renders the XML. From there you should be able to get the XMLGrab plugin to work.