|
Cookbook /
GoogleCalendarSummary: Embeds a Google Calendar in a PmWiki page
Version: 2006-09-30
Prerequisites: PmWiki 2.x
Status: Initial release
Maintainer: zkarj
Categories: Includes
Questions answered by this recipeHow can I embed a Google Calendar in a PmWiki page? DescriptionEmbeds a Google Calendar in a PmWiki page, for viewing. To install, download googlecalendar.phpΔ and install in your cookbook directory, then add the following line to your config.php include_once('cookbook/googlecalendar.php');
See Notes below for usage. NotesThis recipe adds a The minimal form is:
This will display the specified public calendar with default settings (see below). The calendar is displayed inside an HTML Additional, optional parameters may be specified as follows (defaults in bold).
Specify a title to appear on your calendar. Default is "My Calendar". Best to avoid anything other than alphanumeric and spaces. Essentially anything that can appear unescaped in a URL is fine.
Specify what controls will be displayed.
Specify the type of calendar to display.
Specify the width of the frame (and thus the calendar) in pixels. Default is 640.
Specify the height of the frame in pixels. Default is 610 which is just enough for the default calendar (produced with only the
Control the height of each row of the calendar by specifying the number of events that should fit. Only useful for
Specify which day of the week is in the left-most column of the calendar. Only useful for
Specify the background color of the frame. This is a standard HTML hex value including the leading #.
Specify whether a border is drawn in the frame. This is an appoximately 50% gray, single pixel border. Release Notes
CommentsIn 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:
Davide Andrea 11/4/06 Valid XHTML Fix
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 .= '&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>';
------------------------------
-2007/07/12 Diafygi See AlsoContributorsI'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) 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)
User notes?: If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date * (-) Optional negative comment. Name, date These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |