GCal Events
GCal Events is a module which will display upcoming events in a block. The source for these events is a Google Calendar.
Who is this module for?
- If you want to simply and easily add a calendar to your Drupal site with minimal effort, this module is for you.
- If you already have a Google Calendar for your organization and want professional-looking integration
How does it work?
GCal Events subscribes to your Google Calendar's XML feed. It uses SimplePie to cache and parse the XML to get the title, location, date, time, and description from the event. These data fields are displayed in a Drupal block.
FAQs
- Why not use an iCal parser? Good question. iCal is a very complicated format which can handle a lot of complicated scheduling information (repeating/recurring events, etc). As popular as the iCal format is, there are very few iCal parsers available, and none that I could find that met the requirements for this module. That would make for an excellent extension to this module, however.
- Why do I need to download simplepie.inc? SimplePie is a separate project that GCal Events uses to cache and parse XML feeds. SimplePie is released under the BSD License, rather than the GNU Public License that Drupal is licensed with.
Features
Here are some of the interesting features built into GCal Events:
- Can read from public or private google calendar
- Multiple blocks can be set up, each configured independently.
- Date/Time display format can be configured
- Timezone can be configured (PHP 5.1 and higher)
- Display uses templates, so each item (title, location, date, description, url, etc) can be configured for each block. Very flexible and powerful!
- Customizable "footer" to include brief information about the calendar ("provided by so-and-so", "updated weekly", a link to the full calendar, ical feed link, etc)
- Customizable "no upcoming events" text to display when no events are coming up.
- Repeating and all-day events are handled
- "Today Only" option to show only events occurring on this calendar day.
Installation
- untar into modules directory (sites/all/modules)
- Download SimplePie (http://simplepie.org/)
- Copy simplepie.inc into the modules/gcal_events directory
- Create a cache directory that is writeable by the webserver (defaults to modules/gcal_events/cache)
Configuration
- Enable the module in Drupal
- Create an input filter to use for gcal_events (I recommend calling it gcal_events). You will most likely want this input filter to be accessible to anonymous users.
- Make sure to select this new input filter in the gcal events module configuration.
- In the module configuration, set the cache directory and number of blocks to display
- In the block configuration screen, configure block 0. Get the Calendar ID from google calendar.
- Still in the block configuration screen, set the block to an active region and save
You should now see a few upcoming events in the block you configured. You can tweak the title of the block and how the events are displayed in the configuration screens.
How to get Google Calendar ID and Private ID
(Note: As of gcal_events.module version 1.5, you can just copy and paste the XML address and the Calendar ID and Private ID will be parse out automatically) If you are testing out the module and need a calendar to try, I recommend a Google Calendar ID of usa__en@holiday.calendar.google.com. That is a public calendar of US Holidays. It is guaranteed to always have a few upcoming events and should work in all cases.
- Log into your Google Calendar.
- Click on the "Settings" tab.
- Select "Calendars"
- Click on the calendar you want to use.
- In the section labeled "Calendar Address", you should see "Calendar ID". Copy and paste that ID. into the GCal Events configuration.
If you just fill in the Calendar ID, GCal Events will default to using your public calendar. Events marked as private will not show up. If you want to display your private
calendar (not advised):
- Under the section marked "Private Address", click on XML
- You will see a URL that looks something like this:
- For Private ID, you are looking for the section between "private-" and "/basic"
http://www.google.com/calendar/feeds/somename%40gmail.com/private-0562849527c0abe35379accccb4ecfd4/basic
Template Customization
GCal Events was written to be a very flexible and customizable module. Rather than having people download the module and modify the code to meet their unique needs, I tried to write the module in a way that it can be configured to meet the majority of those needs.
Each Google Calendar XML feed contains events with the following fields:
- Title (#TITLE#)
- Location (#LOC#)
- Date (#DATE#)
- Time (#TIME#)
- URL (#URL#)
- Description (#DESC#)
In addition, GCal Events provides these modified fields for your use:
- URL-Encoded Location (#LOCURL#)
An event block uses templates to display these fields in the format you specify. The Event Template is the template that combines all the fields together. You can add html tags or linebreaks as needed between elements.
In addition to the Event Template, each field has a template of its own which specifies what should be done to that field before including it in the Event Template
Typically, you will want to keep the Events Template free of any customization that applies to a field individually, like a bold tag or linebreak tag. This is done so that if a field is missing from the XML feed, the extra linebreak will not be shown (for example, an all-day event will not have a time, so you do not want an extra blank line showing up for that).
Here are some example customizations:
- To get the title to be a link to the event in google calendar:
- To get the location to be a google map:
Title Template: <b><a href="#URL#">#TITLE#</A></b><br>
Location Template: <a href="http://maps.google.com/?q=#LOCURL#">#LOC#</A>
Time/Date Customization
Time and Date formats are very customizable. The default format for time/date display can be configured in the GCal Events administration page. Each block can also be configured to override that if you need a different display in a different block.
Timezone Configuration
On most systems, timezone configuration will not be needed. The "local time" according to the machine hosting your page will be what is used. If the machine is set up using UTC or a different timezone, you may need to select an alternate time zone to display the events correctly.
Feature Requests
- Configurable look-ahead time for events: Set a maximum time to look for events (next 30 days, next 5 days, etc). Current behavior is to look for ALL future events
- Current week/month/year only: Only display events from the current week, month, or year, rather than the next X events which might span a week/month/year border.
- php code: Allow a block of custom php to be executed for the block or for each event. This is a potentially risky feature, and unless a really good reason comes along, I see no reason to add it.
If you want/need one of these features or think of another feature you could use, please let me know! It's possible that it is already possible and just needs to be configured. If not, there's a possibility that if you could benefit from a new feature, somebody else could as well, and that would make a worthwhile addition.
More Information
Authors
- Originally written by Jeff Simpson
- Adapted from code written by James Cridland
Please post issues/suggestions/etc on the GCal Events Project Page. Comments posted here might go months before anybody sees them.

Field template customisations are being stripped?
I've just installed this module with no problems thanks to the excellent docco and readme. One minor problem; I've noticed that field template html formatting is being removed. Interestingly, anchor tags are not.
I initially thought it was related to Filtered Html/Full Html as allowed in custom blocks, but don't see that field for installed blocks. I'm brand new to Drupal (using 6.6) , so might be missing the obvious :-) Thanks!
Same Problem
I'm having the same problem.
Shannon
Crappie101.com Admin
www.crappie101.com
Mine is fixed.
Create an input filter. Be sure to define the items that you wish to be allowed in the filter under Input Formats and then select configure. These are the tags I allowed:
<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <b>. I left Strip Disallowed Tags checked.It was a combination of creating the input filter (under Input formats) as well as applying the input filter (under GCal Events module settings).
Shannon
Crappie101.com Admin
www.crappie101.com
Sample Public Calendar to try
Google U.S. Holidays feed is now
http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.c...
php_network_getaddresses error
Hi!
I tried to read everything about this, but I always get a massage:
"GCal Events[MyGoogleCal] fsockopen error: php_network_getaddresses: getaddrinfo failed"
I tried it with a lot of calendar, last time with the "hungarian__hu@holiday.calendar.google.com" (its a public cal.)
Any idea?
Thanks
Zenit
(System: Drupal 6.10 under Xampp1.7, GCal Events module 6.x-1.4)
I have similar problem
Did you find the solution for this problem?
"We must become the change we want to see" [quote: Mahatma Gandhi]
Go public
It sounds that you have to make your calendar a Public one, When I do this the who page go white blank and if I do the private bit it is still the same, I mean the page go dead white. What can be the problem?
"We must become the change we want to see" [quote: Mahatma Gandhi]
displays none on anonymous users.
This module is really useful.I installed it on my site.and i noticed when i sign out the events wont show inside the block.it just displays none.
how can i fix this?
Thank you!
There's a setting on the
There's a setting on the config screen that needs to select for anonymous users, not just authenticated users.
GCal Events[Block 1] cURL error 7: couldn't connect to host
Hi! Could be a great module, but i got this error, when i test Calendar ID: usa__en%40holiday.calendar.google.com
What could be the problem?
Installed and runs well, some notes tho
If you are having trouble seeing your events because you were testing or using a different calendar, try deleting the cached files. It will "re-pull" the data from Google.
Also, definitely look up php date formatting options and they are helpful in providing good examples of other ways to format your dates.
TimeZone Config?
On read me file it says
I'm in EST and that's what I want my time to show.
I know my server is in PST and either that or something else is throwing all my times off by -3 hours.
I'm stumped how and where to correct. Have tried editing GCal Events settings and the GCal block, referred to http://us2.php.net/manual/en/function.date.php
Thanks
--- --- ----- ----- --- ---
The music business is a cruel and shallow money trench, a long plastic hallway where thieves and pimps run free, and good men die like dogs. There's also a negative side
Time Zone Config where?
My server is set to UTC. I have Drupal's time zone set to +4, but the gcal_events times still all come out in UTC.
I see where it says I may need to select an alternate time zone, but I see no direction on where this setting is made. May I have clue, please?
problem with line breaks
my problem is rather simple I would assume, whenever I insert line breaks in the content customization section, they do not appear when I save the block. Right now my content simply appears as a list with no separation between different events.
simplepie using too much memory?
I'm having memory issues with the simplepie.inc file, tries to allocate too much memory? Maybe just a fluke thing. Don't know yet trouble-shooting now.
Simplepie has a known bug
Simplepie has a known bug with PHP < 5.3. Recursive calls don't free memory. Simplepie makes a TON of them (a trace of a 34k rss feed resulted in 1.1 million function calls. Which works out to a WTF-inspiring ~33 calls per character). All of these recursive calls made by simplepie eat a substantial chunk of the scripts availiable memory resulting in latency and memory issues.
http://simplepie.org/wiki/faq/i_m_getting_memory_leaks
Calendar module!
Can I connect the Gcal events to show up on the calendar as clickable date links?!