Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

GoogleCalendar

Summary: Embeds a Google Calendar in a PmWiki page
Version: 2016-02-11
Prerequisites: PmWiki 2.x
Status: Stable
Maintainer: zkarj, fgonzalez
Categories: Includes, Google

Questions answered by this recipe

How can I embed a Google Calendar in a PmWiki page?

Description

Embeds a Google Calendar in a PmWiki page, for viewing.

Notes and Comments

This recipe adds a (:GoogleCalendar ... :) markup which can be placed in any page.

Installation

  1. Download and copy googlecalendar.phpΔ to the cookbook directory.
  2. Enable the recipe in your local/config.php file with
    include_once("$FarmD/cookbook/googlecalendar.php");

See Notes below for usage.

Markup

The minimal form is: (:GoogleCalendar calendar=myaddress@gmail.com:)

This will display the specified public calendar with default settings (see below). The calendar is displayed inside an HTML <iframe> element.

Aditional, optional parameters may be specified as

(:GoogleCalendar PARAMETERS:)

with the following optional PARAMETERS (default value in bold):

  • title: Title of the calendar (My Calendar)
  • control: Google logo, title and buttons to be displayed (full, navonly, none)
  • mode: Sets the default view for the calendar (week, month, agenda).
  • width: Width of the calendar in pixels (640)
  • height: Height of the calendar in pixels (610)
  • items: Height of each row in month mode (5)
  • week: Day in which each week starts (Sun, Mon, Sat)
  • bgcolor: Calendar's background color in standard HTML hex value (#ffffff)
  • border: Specify whether a border is drawn in the frame. This is an appoximately 50% gray, single pixel border. (on, off)
  • date: Show current date (on,off)
  • print: Show print icon (on,off)
  • tabs: Show the tabs Week, Month and Agenda in the calendar to switch between these modes in the website (on,off).
  • showcals: Shows the arrow in the calendar that allows to switch between the different loaded calendars (on,off)
  • showTz: Shows at the bottom of the calendar the time zone that was set for it (on,off)
  • language: Sets the language in which the calendar is displayed (en [english], [(approve links) edit diff])
  • timezone: Sets the time zone for the calendar, which changes the time of all appointments automatically (options)
  • calendar0, calendar1, ..., calendar100: Sets additional calendars to display. Get the ID of the calendar [(approve links) edit diff]

A more detailed explanation of these options is available below.


title

Example
 (:GoogleCalendar calendar=my-email@gmail.com title="My Appointments")

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.


control

Example
 (:GoogleCalendar calendar=my-email@gmail.com control=navonly :)

Specify what controls will be displayed. full (default) controls will include a Google logo, your calendar title and buttons to increment and decrement the month displayed. navonly controls will omit the logo and title, but a small logo will appear in the bottom right corner, potentially overlaying content. none will remove all controls, meaning viewers cannot navigate to other months and the small logo in the corner is there.

Options: control=full, navonly, none.
Note: This only makes sense when the Birthdays Calendar is included. If the Birthdays Calendar (your contacts birthdays) is not included, the Google logo WILL NOT APPEAR, and full will do the same as navonly. In this case (birthday calendar not included), the option none makes only the navigation arrows dissapear, not the rest of the tabs, which are controled by tabs, print, date (see below). This difference is visible only if you are not logged into gmail (if you are logged in, you will see that same as if you did not have the Birthdays Calendar included; but other users will see the difference).

mode

Example
 (:GoogleCalendar calendar=my-email@gmail.com mode=agenda :)

Specify the type of calendar to display. month is a standard month calendar, agenda is a list of events. week shows the current week only if the Birthday Calendar is not included (you do not notice the difference if you are logged into gmail).

Options: mode=week, month, agenda.

width

Example
 (:GoogleCalendar calendar=my-email@gmail.com width=420 :)

Specify the width of the frame (and thus the calendar) in pixels. Default is 640.


height

Example
 (:GoogleCalendar calendar=my-email@gmail.com height=510 :)

Specify the height of the frame in pixels. Default is 610 which is just enough for the default calendar (produced with only the calendar= parameter). If the height is not enough to show the entire calendar, a scroll bar will appear in the frame. Note that the appearance of the calendar height is dependent on the following parameter - not this one.


items

Example
 (:GoogleCalendar calendar=my-email@gmail.com calendar0=#contacts@group.v.calendar.google.com items=2 :)

If the Birthday Calendar is included (as in the example above is), items controls the height of each row of the calendar by specifying the number of events that should fit.

Notes: Only useful for mode=month. See how to add different calendars using calendar0, ... , calendar100 below.

week

Example
 (:GoogleCalendar calendar=my-email@gmail.com week=Sat :)

Specify which day of the week is in the left-most column of the calendar. Only useful for mode=month.

Options: week=Mon, Sat, Sun.

bgcolor

Example
 (:GoogleCalendar calendar=my-email@gmail.com bgcolor=#80BFFF :)

Specify the background color of the frame. This is a standard HTML hex value. The hash (#) is not relevant here. For example, bgcolor=#ffffff and bgcolor=ffffff are both valid.

Note: Some colors available here

border

Example
 (:GoogleCalendar calendar=my-email@gmail.com border=on :)

Specify whether a border is drawn in the frame.

Options: border=on, off

date

Example
 (:GoogleCalendar calendar=my-email@gmail.com date=off :)

Display or hide the date on the calendar, at the right of the navigation tabs.

Options: date=on, off
Note: It does not work if the Birthdays calendar is included! (although you will see the changes if you are logged into gmail)

print

Example
 (:GoogleCalendar calendar=my-email@gmail.com print=off :)

Display or hide the print icon.

Options: print=on, off
Note: It does not work if the Birthdays calendar is included! (although you will see the changes if you are logged into gmail)

tabs

Example
 (:GoogleCalendar calendar=my-email@gmail.com tabs=off :)

Show/hide the tabs "Week", "Month" and "Agenda". If you switch them off, you will not be able to change the mode from your browser (it locks the mode value), although you will still be able to navigate through different months if the navigation tabs are activated (see control).

Options: tabs=on, off
Note: It does not work if the Birthdays calendar is included! (although you will see the changes if you are logged into gmail)

showcals

Example
 (:GoogleCalendar calendar=my-email@gmail.com showcals=off :)

Show/hide the icon with the arrow in the calendar that allows to switch between the different loaded calendars (see calendar0,...,calendar100 parameters).

Options: showcals=on, off
Note: It does not work if the Birthdays calendar is included! (although you will see the changes if you are logged into gmail)

showTz

Example
 (:GoogleCalendar calendar=my-email@gmail.com showTz=off :)

Display/hide the time zone at the bottom of the calendar. To change the calendar time zone, see timezone parameter below.

Options: showTz=on, off
Note: It does not work if the Birthdays calendar is included! (although you will see the changes if you are logged into gmail)

language

Example
 (:GoogleCalendar calendar=my-email@gmail.com language=spanish :)
 (:GoogleCalendar calendar=my-email@gmail.com language=french :)
 (:GoogleCalendar calendar=my-email@gmail.com language=italian :)
 (:GoogleCalendar calendar=my-email@gmail.com language=chinese :)
 (:GoogleCalendar calendar=my-email@gmail.com language=japanese :)
 (:GoogleCalendar calendar=my-email@gmail.com language=russian :)
 (:GoogleCalendar calendar=my-email@gmail.com language=hindi :)
 (:GoogleCalendar calendar=my-email@gmail.com language=greek :)

This option allows you to change the language in which the calendar is displayed. There is a huge list of languages available, which can be seen at [(approve links) edit diff]


timezone

Example
 (:GoogleCalendar calendar=my-email@gmail.com timezone=easterntime :)
 (:GoogleCalendar calendar=my-email@gmail.com timezone=santiago :)
 (:GoogleCalendar calendar=my-email@gmail.com timezone=buenosaires :)
 (:GoogleCalendar calendar=my-email@gmail.com timezone=centraltime :)
 (:GoogleCalendar calendar=my-email@gmail.com timezone=tokio :)
 (:GoogleCalendar calendar=my-email@gmail.com timezone=paris :)

This option allows you to change the time zone of the calendar, which changes the time of all appointments automatically. See all available timezones in this link.


calendar0, calendar1, calendar2, ... , calendar100

Example
 (:GoogleCalendar calendar=my-email@gmail.com calendar0=#contacts@group.v.calendar.google.com :)
 (:GoogleCalendar calendar=my-email@gmail.com calendar23=es-419.cl#holiday@group.v.calendar.google.com :)
 (:GoogleCalendar calendar=my-email@gmail.com calendar51=ht3jlfaac5lfd6263ulfh4tql8@group.calendar.google.com :)
 (:GoogleCalendar calendar=my-email@gmail.com calendar1=en.christian#holiday@group.v.calendar.google.com calendar2=en.usa#holiday@group.v.calendar.google.com :)

This option allows you to insert as many calendars (from 0 to 100) as you want. The examples above show, in order, your contacts birthdays calendar; the holidays in Chile; the "Phases of the Moon" calendar; and the christian holidays together with the United States national holidays. As you can see, you can label the calendars in any order, and with any number you want. You can combine holidays of different countries with your different personal calendars.

The ID of the calendar can be obtained from your gmail account. Just go to your google calendar through your gmail account and click on the arrow icon, at the left of its name. Then click on "Calendar settings" and you will see a configuration screen where the category "Calendar Address" shows Calendar ID: xxxxx@group.calendar.google.com, or something like that. Copy that ID as shown in the examples above to include a specific calendar.

If you want to see other calendars available (jewish, muslim, orthodox holidays; weather, sports and others), just go to your gmail Calendar -> Other Calendars -> Browse Interesting Calendars.

Warning: If you enable the Birthdays (your contacts) calendar, the commands date, print, tabs, showcals, showTz will have no effect on the calendar. Instead, the display will be controlled by control, mode and items commands (other commands, like language and timezone will still work).

Example

You can see the recipe live here.

Release Notes

2016-02-11
MAJOR UPDATE Fixed issues:
  • Added new languages, new time zones, and new calendars.
  • New features added: date, print, tabs, showcals, showTz, language, timezone,
  • New calendars added: now the options calendar0, calendar1, ..., calendar100 are available. See calendars above.
  • Now bgcolor accepts the "#". bgcolor=#ffffff and bgcolor=ffffff are both valid.
  • The block of text (reported by Glen Patras) has been removed. No text at the top of your page anymore.
2006-09-30
Initial release (googlecalendar-old.phpΔ)

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See Also

  • Cookbook:Ape can embed public Google calendars by simply pasting their "share" address into the wiki page.

Contributors

Comments

See Discussion at GoogleCalendar-Talk


User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on February 17, 2016, at 05:35 PM