Hi all,
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="[email protected]" from="February 10, 2007" show_future="true" sort_order="a" limit="5" refresh="120"}
<ul>
<li>
{if description}<a href="http://{description}">{title}</a>{if:else}{title}{/if}
from {start_time format="%Y-%m-%d %H:%i"} to {end_time format="%Y-%m-%d %H:%i"} <br>
location: {location} <br>
<a href="http://{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.
Hope this is of use to some.
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!
Hi Matt:
Thanks for the great plugin as it wasn’t hard at all to implement. I’m having two issues I can’t get my head around:
You can view at: http://www.thecubanguy.com/index.php
And…
Cheers for this great plugin!
Is there anyway one of you could explain this to me? I’ve implemented the code
{exp:gcal gcal_id="[email protected]" from="June 3, 2009" show_future="true" orderby="d" limit="5"}
<ul>
<li>
{if description}<a href="http://{description}">{title}</a>{if:else}{title}{/if}
from {start_time format="%Y-%m-%d %H:%i"} to {end_time format="%Y-%m-%d %H:%i"} <br>
location: {location} <br>
<a href="http://{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.
I would love some help on this please.
Travis
just an update.
Once I took out the from=”June 3, 2009” the code worked fine for me. Just in case anyone else is having any problems.
I’m also looking for a solution to display events from multiple calendars if anyone has any directions to point me in.
Thanks
Travis Masingale
@tmassingale,
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.
any help?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.