Using Google Calendar for your Caving Club diary

Discussion about BCA's Internet Hosting Service
User avatar
David Gibson
Posts: 600
Joined: Thu 16 Mar 2006 23:45

Using Google Calendar for your Caving Club diary

Post by David Gibson » Mon 16 Mar 2020 15:47

BCRA has started using Google Calendar for listing our events. Our motivation for doing this, rather than relying on the BCA diary was that Google Calendar is easier for "lay people" to update, and it can be widely circulated, and used in an iframe. You can see it on BCRA's website at http://bcra.org.uk, in its own scrolling frame. There are, however, some problems that I had to address.

If you use it "as is", you will notice that it will not, as a default, list all your events. The only way to get it to list all your events is to keep clicking on "Look for more" or to waggle the scroll bar up and down a bit. I asked an "expert" on a Google forum about it and he confirmed the deficiency: you cannot configure the iframe with a specified range of dates to display.

For BCRA, I solved the problem by writing 500 lines of code to process Google's data in the way I wanted. I think the result is an improvement - you can see my output on the BCRA home page, where I have included pull-down sections of further information.

As I did it in a hurry, Im expecting it to break when someone enters an event that my parser doesnt like the look of. As well as displaying a list of events, my code also generates the "Our next event" box. Note to self: I need to modify this to display the next two events, for the situation when we have two that are close together.

A further problem with the Google Calendar is that if you include a URL in the Event Description, it opens that page within the iframe, which makes it unreadable on the BCRA web page, where the iframe is limited to a few hundred pixels wide. I may have missed something, but I could not see any way of adding a TARGET="_blank" attribute to the Google Calendar URLs, which would force them to open in a new window.

I solved the problem by editing the URLs as the data was parsed into the structure used on the BCRA web page; adding the TARGET="_blank" attribute. I was also able to do other embellishments at that point, e.g. if the parser sees the word "POSTPONED" it outputs it in red.

Updated 17-Mar-2020 as Im no longer using a "hook" page to open the URL in a new page. See http://bcra.org.uk/calendar/openWindow.html
Last edited by David Gibson on Tue 17 Mar 2020 11:47, edited 1 time in total.
Reason: updated 17-Mar-2020 as Im no longer using a "hook" page to open the URL in a new page.