Plugin

Community
Support

Matthew Romaine does not actively monitor this forum
(but you can still get help from other EE users).

EE 1
EE 2
Google Calendar

Back to this add-on's main page
View Other Add-ons From Matthew Romaine

     

You must be logged in to post.

updated for ee 2.x, added features, custom tags

General

kinder
kinder

I’ve made some updates to the code, and I thought I would post it here, in case anyone else might find it useful:

- a quick run-through to migrate from EE 1.6.x to 2.x (very easy, thanks to EllisLab’s excellent docs!)
- added ‘date_header’ template tag processing (a la the Channels module)
- added (for my purposes) the ability to process some “custom fields” from the Google calendar event description, namely:
  - url: where to link for more information
  - contact: where to e-mail for more information
  - tags: comma-separated list of tags to match, to give the ability to display only events that match a particular tag

The attached zip file contains the original simplepie.inc so you’ll have everything you need in one download.

—Kurt

=====
Sample usage:

<ul>
{exp:gcal gcal_id="your_google_calendar_id" gcal_tags="{embed:my_calendar_tags}"}
  {if no_results}
    
<div class="date">Calendar</div>
    
{if '{embed:my_no_result_text}'}
      {embed
:my_no_result_text}
    {if
:else}
      
<p>No events scheduled.</p>
    
{/if}
  {
/if}
  {date_header display
="daily"}
  
<li><div class="date">{start_time format="%F %j, %Y"}</div><ul>
  
{/date_header}
  
<li>
    
{if url}
    
<span class="title"><a href="{url}">{title}</a></span><br />
    
{if:else}
    {title}
<br />
    
{/if}
    
<span class="times">
    
{if {start_time format="%Y-%m-%d"== {end_time format="%Y-%m-%d"}}
      {start_time format
="%g:%i%a"{end_time format="%g:%i%a"}
    {if
:else}
      {start_time format
="%F %j"{end_time format="%F %j"}
    {
/if}</span><br />
    
{if contact_address AND contact_name}
    
<span class="contact">Contact{encode={contact_address} title={contact_name}}</span><br/>
    
{/if}
    {if location}
    
<a href="http://maps.google.com/maps?hl=en&q={location}" class="noicon"><img src="/ui/icons/map.png" width="16" height="16"
      
alt="Map to '{location}'" title="Map to '{location}'" /></a>&nbsp;
    
{/if}
    
<a href="{link}"><img src="/ui/icons/calendar_add.png" width="16" height="16"
      
alt="Add to your Google calendar"
      
title="Add to your Google calendar" /></a>
  </
li>
  
{date_footer display="daily"}
  
</ul></li><!-- end daily -->
  
{/date_footer}
{
/exp:gcal}
</ul
File Attachments
pi.gcal.zip  (File Size: 66KB - Downloads: 88)