GoogleCalendar-Talk

Summary: Talk page for GoogleCalendar.
Maintainer: zkarj, fgonzalez
Users: +1 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Please leave the latest message at the top.



Here's a patch to run googlecalendar.php if your system doesn't like Markup /e:

index c6f3258..032e760 100644
--- a/cookbook/googlecalendar.php
+++ b/cookbook/googlecalendar.php
@@ -15,10 +15,10 @@
 $RecipeInfo['GoogleCalendar']['Version'] = '2016-02-09';


-Markup('GoogleCalendar', 'directives',  '/\\(:GoogleCalendar (.*?):\\)/e', 'DspGCal("$1")');
+Markup('GoogleCalendar', 'directives',  '/\\(:GoogleCalendar (.*?):\\)/', 'DspGCal');

 function DspGCal($opts) {
-  $args = ParseArgs($opts);
+  $args = ParseArgs($opts[1]);

   if (!$args['calendar']) { $output = "Undefined Google Calendar"; }
     else { // valid calendar

--

~~ Damien Palmer July 15, 2017, at 08:30 AM



10/Oct/2012 - Adam Phoenix I added the following to enable extra calendars to be embedded:

  if ($args['calendar0'])
	$output .= '&src=' . $args['calendar0'];
  if ($args['calendar1'])
	$output .= '&src=' . $args['calendar1'];
  if ($args['calendar2'])
	$output .= '&src=' . $args['calendar2'];
  if ($args['calendar3'])
	$output .= '&src=' . $args['calendar3'];
  if ($args['calendar4'])
	$output .= '&src=' . $args['calendar4'];
  if ($args['calendar5'])
	$output .= '&src=' . $args['calendar5'];
  if ($args['calendar6'])
	$output .= '&src=' . $args['calendar6'];
  if ($args['calendar7'])
	$output .= '&src=' . $args['calendar7'];
  if ($args['calendar8'])
	$output .= '&src=' . $args['calendar8'];
  if ($args['calendar9'])
	$output .= '&src=' . $args['calendar9'];

This enables the use of "calendar=maincalendar@gmail.com calendar0=en.australian%23holiday%40group.v.calendar.google.com" for example.



In general, only a "public" Google calendar will be shown. If you want to show a private calendar (which, of course, you would only do in a password protected page), use this form:

(:GoogleCalendar calendar=myaddress%40gmail.com&pvttk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:)

Where xxx... is the key that you get from Google Calendar:

  • Settings (links at top left of page)
  • Calendar Settings / Calendars
  • Calendar Settings / My Calendars / Calendar / <my calendar's name>
  • <my calendar's name> Details / Calendar Details / Private Address (bottom of page) / HTML
  • Copy the link address, take the key from it

Davide Andrea 11/4/06



The script gets some extras lines at the top. You have to get rid of all lines before

<?php

and replace this line by

<?php if (!defined('PmWiki')) exit ();

You also have to avoid the "#" character when specifying colors in bgcolor because the script adds it allready (which is not very handy after all).

Fabien Villard (Feb 2010)



I'm having trouble with the required codes to get this to work... it also puts a block of text at the top of the screen if it's used (?) This is the first recipe I've had trouble using!

I'm trying to make it display as 300x350 with the print icon, tabs, calendar list and time zone set to not show.

Also, what is the code to make it display other calendar info as well (:ie calendar + regional holidays calendar + local events calendar) There are checkboxes to add it to the standard mark up google provides.

Glen Patras (May 15, 2009)



Valid XHTML Fix
Unfortunately, the current version of GoogleCalendar recipe does not give valid XHTML 1.0 Transitional. So, I've made some changes on the code to fix this. Here are my changes:

In 'googlecalendar.php' from line 29 to 47.
from:
------------------------------
  $output  = '<iframe src="http://www.google.com/calendar/embed?';
  $output .= 'src=' . $args['calendar'];
  $output .= '&title=' . $args['title'];
  if ($args['control'] == 'navonly') { $output .= '&chrome=NAVIGATION'; }
    elseif ($args['control'] == 'none') { $output .= '&chrome=NONE'; }
  if ($args['mode'] == 'agenda') { $output .= '&mode=AGENDA'; }
  $output .= '&epr=' . $args['items'];
  $output .= '&wkst=';
  if ($args['week'] == 'Sun') { $output .= '1'; }
    elseif ($args['week'] == 'Mon') { $output .= '2'; }
    else  { $output .= '7'; }
  if ($args['bgcolor']) { $output .= '&bgcolor=%23' . $args['bgcolor']; }
  $output .= '&height=' . $args['height'] . '"';
  if ($args['border'] == 'off') { $output .= ' style="border-width:0"'; }
    else { $output .= ' style="border:solid 1px #777"'; }
  $output .= ' width=' . $args['width'];
  $output .= ' frameborder="0"';
  $output .= ' height=' . $args['height'];
  $output .= '></iframe>';
------------------------------
to:
------------------------------
  $output  = '<iframe src="http://www.google.com/calendar/embed?';
  $output .= 'src=' . $args['calendar'];
  $output .= '&amp;title=' . $args['title'];
  if ($args['control'] == 'navonly') { $output .= '&amp;chrome=NAVIGATION'; }
    elseif ($args['control'] == 'none') { $output .= '&amp;chrome=NONE'; }
  if ($args['mode'] == 'agenda') { $output .= '&amp;mode=AGENDA'; }
  $output .= '&amp;epr=' . $args['items'];
  $output .= '&amp;wkst=';
  if ($args['week'] == 'Sun') { $output .= '1'; }
    elseif ($args['week'] == 'Mon') { $output .= '2'; }
    else  { $output .= '7'; }
  if ($args['bgcolor']) { $output .= '&amp;bgcolor=%23' . $args['bgcolor']; }
  $output .= '&amp;height=' . $args['height'] . '"';
  if ($args['border'] == 'off') { $output .= ' style="border-width:0"'; }
    else { $output .= ' style="border:solid 1px #777"'; }
  $output .= ' width="' . $args['width'] . '"';
  $output .= ' frameborder="0"';
  $output .= ' height="' . $args['height'] . '"';
  $output .= '></iframe>';
------------------------------

-2007/07/12 Diafygi



Talk page for the GoogleCalendar recipe (users).