Displays a list of upcoming events from one or more Google Calendars in your web site. Each event includes the what, where, when and description variables from the Google Calendar page. In addition to a start_time variable, the start_day variable pair lets you create a date header that appears above the first event in a day.
Tested with ExpressionEngine 1.6.8. Requires the free Zend Gdata package.
I originally developed this for a recent site which needed to show upcoming events from different calendars. On the front page you’ll notice the events are grouped by calendar, but the plugin supports mixing events from different calendars into a single chronologically-ordered event list.
Hi Paul, did you check your PHP error log for error messages? Do you have the Zend Gdata package installed on your PHP include path? I tried to make the plugin log any issues it finds to the error log.
thanks for the quick response. Well, I’m trying to get it working on an Expression Engine install for my church. unfortunately, their current web host provider is Yahoo Small Business hosting. I have EE up and running fine, but I do have various other plugins installed.
I really do not know how to view the php error log. Nor do i know if they have Zend Gdata package installed. I ran a phpinfo on the site. it’s running PHP Version 4.3.11. Is there a way to tell if gdata is installed?
what I may have to do is try it on my personal site, instead; as it is hosted by mediatemple. I’ll try it on my host provider and see if I get the same results, and get back to you. Definitely excited about your plugin, as I’ve tried someone else’s on the forums, but had mixed results and the developer never responded to question.
In phpinfo() see the “error_log” setting to find out where your PHP error log file is located. However, the Zend Gdata page says its for PHP 5 so this may not work for you.
The site I developed this plugin for (http://www.tbaoakland.org/) is hosted for free on DreamHost under their non-profit discount program. They’re running PHP 5.2.10, and although installing Zend Gdata required creating a custom php.ini file this step is well-documented and takes little time. I highly recommend them whether you’re not using using their free-for-nonprofits discount.
I am really sorry for this being very newb questions, but I am a front end developer and know little about the mysteries of the database.
1. Zend Gdata package and install the Zend library in a directory in your PHP Include Path.
I downloaded the package and created a folder for it. put the 4 folders in there and uploaded it to the server.
In the instructions it says
“add the library directory to your PHP include_path. To use components in the extras library, add the extras/library”
What exactly is the “PHP Include Path”?
2. Next I added your PHP file and for some reason the code destroyed the plugin manager page (see attached image) Now when I remove everything below ?> it goes back to normal but everything in the usage column is gone.
3. Where do I derive the google_calendars - The Google Calendar id?
I went into my google private calendar and couldn’t find it. Do I create a new public calendar? And where would I be able to find the ID.
Again, sorry if this is very newb for you… and appreciate your time.
V
In phpinfo() see the “error_log” setting to find out where your PHP error log file is located. However, the Zend Gdata page says its for PHP 5 so this may not work for you.
The site I developed this plugin for (http://www.tbaoakland.org/) is hosted for free on DreamHost under their non-profit discount program. They’re running PHP 5.2.10, and although installing Zend Gdata required creating a custom php.ini file this step is well-documented and takes little time. I highly recommend them whether you’re not using using their free-for-nonprofits discount.
Just wanted to thank you real quick with the tip of signing up for Dreamhost’s free non-profit hosting. Just did this yesterday for my organization. Now I’m in the progress of moving my EE site over to them. Will get back to you if I run into any trouble with using your Calendar Events plugin. Thanks again, I owe you one!
In phpinfo() see the “error_log” setting to find out where your PHP error log file is located. However, the Zend Gdata page says its for PHP 5 so this may not work for you.
The site I developed this plugin for (http://www.tbaoakland.org/) is hosted for free on DreamHost under their non-profit discount program. They’re running PHP 5.2.10, and although installing Zend Gdata required creating a custom php.ini file this step is well-documented and takes little time. I highly recommend them whether you’re not using using their free-for-nonprofits discount.
Okay, so I’m up and running on dreamhost. You say to install Zend GData into the php include path, but how do I get access to do that? Also, can you provide instructions on exactly how I should setup the php.ini? My php error_log says ‘no value’. not sure how to get this up and running. any help is appreciated.
Hi Vlad, check the PHP Info page (Admin -> Utilities -> PHP Info) and view the include_path entry to see a colon-delimited list of directories in which PHP will look for libraries. You should have the “Zend” directory copied into one of these directories (eg <directory>/Zend/Loader.php). I apologize about the plugin manager page, it might be due to not finding the Zend Gdata but I alread check against that. Hmm. Regarding where to find the calendar id - select Calendar Settings in the dropdown next to your calendar, the calendar id is in the Calendar Address section near the bottom.
Hi Paul, see dreamhost’s instructions for creating a custom php.ini file, you can then create a custom php libs directory (eg ~/phplibs), install Zend [and maybe xcache] there, and add this directory to the include_path entry in your custom php.ini.
when you say “The number of days to display”, does it really mean the number of calendar events to display? or is it referring to it only shows events X number of days out from the current date? looks to be the latter. is there anyway to add a parameter that says limit to only the next X upcoming events from the current date or something similar?
why i ask is, say I set it to look out 7 days. one week there may only be 2 events in the next 7 days, but another week it could be 7 events. such a variety in the possible # of events being shown makes it tough on the layout.
I’d love it if it could just show the next X number of upcoming events—that way, it’ll always show the same amount of events.
I really haven’t dove into Gdata yet, so I am being optimistic in hoping such a request is not too hard and maybe you’d be willing to implement it into your already working plugin?
some other suggestions are to have a sort parameter, a date ‘from’ and a date ‘to’ parameter.
Hi Vlad, check the PHP Info page (Admin -> Utilities -> PHP Info) and view the include_path entry to see a colon-delimited list of directories in which PHP will look for libraries. You should have the “Zend” directory copied into one of these directories (eg <directory>/Zend/Loader.php). I apologize about the plugin manager page, it might be due to not finding the Zend Gdata but I alread check against that. Hmm. Regarding where to find the calendar id - select Calendar Settings in the dropdown next to your calendar, the calendar id is in the Calendar Address section near the bottom.
Thank you for the fast response. I am talking to my webadmin now.
include_path.:/usr/share/php:/usr/share/pear
I dont have access to that particular section of the server so I have asked him what does he suggest.
Ok my hosting guy hooked it up.
It is reading the events from the calrndar but spitting out the following error.
Notice: ob_end_clean() [ref.outcontrol]: failed to delete buffer. No buffer to delete. in /var/customers/webs/Gabe/cms_admin/plugins/pi.googlecal_events.php on line 522
on top of that it’s shooting out
# Description The {exp:googlecal_events} tag displays a list of upcoming events in chronological order from one or more Google Calendars. Requres the free Zend Gdata package (http://framework.zend.com/download/gdata) and a working Google account to use. # Parameters google_calendars     The Google Calendar id (eg “12345@group.calendar.google.com”) or a comma-delimited list of id’s. user     The username of your Google account (your Gmail address should work here). password     The password of your Google account. num_days     The number of days to display max_cache_age [optional]     The maximum age in seconds of the local file cache for the events. If not specified, the default value of 900 (15 minutes) will be used. # Single Variables {start_time format=”%Y %m %d”}     The start time of the event {end_time format=”%Y %m %d”}     The end time of the event {what}     The title of the event (from the “what” field in Google Calendar) {where}     The location of the event (from the “where” field in Google Calendar) {description}     The description of the event (from the “description” field in Google Calendar) # Variable Pairs {start_day} {start_day_format format=”%Y %m %d”} {/start_day}     The start time of the event, only displayed for the first event each day # Example 1 - Simple List Of Events {exp:googlecal_events google_calendars=”” user=”” password=”” num_days=“14” }     {start_time format=”%g:%i %a”}: {what} ({where})
{/exp:googlecal_events} # Example 2 - TV Shows This Week {exp:googlecal_events google_calendars=“3t2brro1crmt94uuqomrgipqiulm7fs7@import.calendar.google.com” Â Â Â Â user=”” password=”” num_days=“7” } Â Â Â Â {start_day}
{start_day_format format=”%l, %M %j %Y”}
{/start_day} Â Â Â Â {start_time format=”%g:%i %a”} - {what}
   Â
{description}
Vlad: Glad you got Gdata installed. This error looks like a common PHP gotcha with output buffering, I’ll try to fix, test and release a new version that won’t cause this. As a temporary workaround, can you edit your php.ini and (1) enable output_buffering, or (2) set the error reporting level to not include e_notice errors, or (3) disable display_errors (and use log_errors)?
Quick question: can I not use global EE variables like {count} within your calendar plugin tags? I was trying do a workaround for showing only a certain # of events like in the code below
i.e. say there’s 15 events within the next 30 days, but only wanted to show the next 7. I tried outputting {count} to the screen, but it ignored it, and instead literally outputted {count} as text.
Vlad: Glad you got Gdata installed. This error looks like a common PHP gotcha with output buffering, I’ll try to fix, test and release a new version that won’t cause this. As a temporary workaround, can you edit your php.ini and (1) enable output_buffering, or (2) set the error reporting level to not include e_notice errors, or (3) disable display_errors (and use log_errors)?
Ok so before I made an ass out of myself I reloaded the Zend files and your extension.
I see you updated your plugin to have a max_events param! thanks! that rocks. I noticed one needs to still have the num_days param in there and have it come first before the max_events attribute. but it works great. thanks again!