Plugin: Google Calendar Events
Posted: 29 March 2010 07:07 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  7
Joined  05-31-2009

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.

The pi.googlecal_events.php plugin is available at http://github.com/swartzrock/brs.googlecal_events.ee_addon and includes full installation and usage docs.

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.

Profile
 
 
Posted: 04 April 2010 02:06 PM   [ Ignore ]   [ # 1 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  02-24-2009

I put the .php file in my system/plugins folder and now my plugin page seems to come up blank or other times it redirects to your plugin wiki page.

any help is appreciated. trying on version 1.6.8 of EE

 Signature 

- paul j.

Profile
 
 
Posted: 04 April 2010 03:02 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  7
Joined  05-31-2009

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.

Profile
 
 
Posted: 04 April 2010 03:14 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  02-24-2009

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.

what host provider do you use?

 Signature 

- paul j.

Profile
 
 
Posted: 04 April 2010 03:27 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Avatar
Total Posts:  7
Joined  05-31-2009

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.

Profile
 
 
Posted: 15 April 2010 06:08 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  268
Joined  02-18-2008

Hi Jason,

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

Image Attachments
Screen shot 2010-04-15 at 6.01.06 PM.png
Click thumbnail to see full-size image
 Signature 

Bangkok Web Design.com

Profile
 
 
Posted: 15 April 2010 11:18 AM   [ Ignore ]   [ # 6 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  02-24-2009
swartzrock - 04 April 2010 07:27 PM

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!

 Signature 

- paul j.

Profile
 
 
Posted: 15 April 2010 09:02 PM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  02-24-2009
swartzrock - 04 April 2010 07:27 PM

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.

 Signature 

- paul j.

Profile
 
 
Posted: 16 April 2010 10:57 AM   [ Ignore ]   [ # 8 ]  
Summer Student
Avatar
Total Posts:  7
Joined  05-31-2009

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.

Profile
 
 
Posted: 16 April 2010 12:08 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  02-24-2009

thanks, i got it working now!

 Signature 

- paul j.

Profile
 
 
Posted: 16 April 2010 06:58 PM   [ Ignore ]   [ # 10 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  02-24-2009

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.

thanks again! love this plugin!

 Signature 

- paul j.

Profile
 
 
Posted: 19 April 2010 06:00 AM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  268
Joined  02-18-2008
swartzrock - 16 April 2010 02:57 PM

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.

Hope he can come through for me.

 Signature 

Bangkok Web Design.com

Profile
 
 
Posted: 19 April 2010 07:01 AM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  268
Joined  02-18-2008

Hi Jason,

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}

You can full text see it on page http://avs.bkkwebdesign.com/class_schedule/cal_test/

If you have any idea I would appreciate your help.
Thank you :D

 Signature 

Bangkok Web Design.com

Profile
 
 
Posted: 20 April 2010 01:24 AM   [ Ignore ]   [ # 13 ]  
Summer Student
Avatar
Total Posts:  7
Joined  05-31-2009

Paul: Thanks for the suggestion, I’ve saved it as an enhancement (http://github.com/swartzrock/brs.googlecal_events.ee_addon/issues/issue/2) and will try to get that feature implemented.

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

Profile
 
 
Posted: 20 April 2010 12:27 PM   [ Ignore ]   [ # 14 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  02-24-2009

Thanks. it’s appreciated.

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

{exp:googlecal_events google_calendars="<cal>" user="<user>" 
    
password="<password>" num_days="30" }

   {if count 
<=7 }
    {start_time format
="%g:%i %a"}{what} ({where})<br>
   
{/if}
{
/exp:googlecal_events} 

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.

Thanks again!

 Signature 

- paul j.

Profile
 
 
Posted: 23 April 2010 11:20 AM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  268
Joined  02-18-2008
swartzrock - 20 April 2010 05:24 AM

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.

it still doesnt show up on my page: http://avs.bkkwebdesign.com/class_schedule/cal_test/

my EE text is copied and pasted from your template.

{exp:googlecal_events google_calendars="ud4pndiafd1do70tjtks6u0e34@group.calendar.google.com" user="my_email@gmail.com" 
    
password="*******" num_days="14" }
    {start_time format
="%g:%i %a"}{what} ({where})<br>
{/exp:googlecal_events} 

It shows some of the events from the calendar but not the whole thing. And on top there is a whole ton of code…

I’m not sure why it doesn’t work. Any ideas? Please help me out here, the client is getting impatient, this is the only thing holding back the site.

Thank you,
Vlad

 Signature 

Bangkok Web Design.com

Profile
 
 
Posted: 27 May 2010 07:33 PM   [ Ignore ]   [ # 16 ]  
Grad Student
Rank
Total Posts:  60
Joined  07-11-2008

Is there a benefit of this method over using Googles native embed code?

Profile
 
 
Posted: 27 May 2010 07:34 PM   [ Ignore ]   [ # 17 ]  
Grad Student
Rank
Total Posts:  60
Joined  07-11-2008

Is there a benefit of doing this over using native embedd code?

Profile
 
 
Posted: 30 May 2010 02:32 PM   [ Ignore ]   [ # 18 ]  
Grad Student
Avatar
Rank
Total Posts:  34
Joined  02-24-2009

@swartzrock,

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!

 Signature 

- paul j.

Profile