We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: display public Google Calendar

Development and Programming

matt romaine's avatar
matt romaine
50 posts
17 years ago
matt romaine's avatar matt romaine

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.

       
jthomas's avatar
jthomas
4 posts
17 years ago
jthomas's avatar jthomas

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?

       
matt romaine's avatar
matt romaine
50 posts
17 years ago
matt romaine's avatar matt romaine

Yep, this was built for version 1.6.3.

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.

lemme know if that does anything.

       
ignite's avatar
ignite
149 posts
17 years ago
ignite's avatar ignite

Wow perfect timing! This is exactly what I need. I’ll give it a shot and let you know how it goes. :D Thanks!

       
jthomas's avatar
jthomas
4 posts
17 years ago
jthomas's avatar jthomas

Hey ignite, how’d this work out for you? I never did get it. I also haven’t tackled it again since my last post.

       
ignite's avatar
ignite
149 posts
17 years ago
ignite's avatar ignite

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. 😉

       
Adrienne L. Travis's avatar
Adrienne L. Travis
213 posts
17 years ago
Adrienne L. Travis's avatar Adrienne L. Travis

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?

       
ignite's avatar
ignite
149 posts
17 years ago
ignite's avatar ignite

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?

       
LHDonline's avatar
LHDonline
18 posts
about 17 years ago
LHDonline's avatar LHDonline

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!

       
Alli's avatar
Alli
158 posts
16 years ago
Alli's avatar Alli

I am getting an error: GCal error: Unable to retrieve feed from Google => Invalid value for start-min parameter: c

Any suggestions?

Thanks

       
October11's avatar
October11
183 posts
16 years ago
October11's avatar October11

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:

  1. I’m getting this error on my page: Notice: Undefined index: in D:\web\vhosts\thecubanguy.com\httpdocs\tcgadmin\plugins\pi.gcal.php on line 291

You can view at: http://www.thecubanguy.com/index.php

And…

  1. The feed is showing an entry almost 7 days old on top of the list. How do I get the plugin to show upcoming entries from today and on?

Cheers for this great plugin!

       
October11's avatar
October11
183 posts
16 years ago
October11's avatar October11

Well, I got to suppress the error for now; figuring if everything is working fine. (Hate to do this kind of things, but well tight-deadline).

Added this line on the pi.gcal.php file:

<?php error_reporting (E_ALL ^ E_NOTICE); ?>
       
tmasingale's avatar
tmasingale
2 posts
16 years ago
tmasingale's avatar tmasingale

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

       
tmasingale's avatar
tmasingale
2 posts
16 years ago
tmasingale's avatar tmasingale

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

       
Paul  J.'s avatar
Paul J.
33 posts
16 years ago
Paul  J.'s avatar Paul J.

@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?

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.