#native_company# #native_desc#

Using PHP to Make Basic vCalendar/iCalendar Events

By PHP Builder Staff
on October 30, 2002

by: Shu-wai Chow
If you maintain a web calendar, the vCalendar/iCalendar specifications can help you share calendar events with users through your site. By clicking on a simple link to a text file, your events can be added to your users’ Outlook, Palm Desktop, or scheduling program of their choice. Such an application can be easy, simple, and automated if the event data is stored in a database, and the text file is formatted to the vCalendar/iCalendar specification with any scripting language.
The vCalendar and iCalendar specifications are designed for platform and device neutral sharing of calendar and to-do items. Since its inception, the vCalendar specification has quietly gained ubiquitous support in software applications and spawned its successor, the iCalendar format. Most of the popular calendaring programs such as Outlook, Palm Desktop, and LotusNotes support one or both formats. Recently, iCalendar gained a big endorsement by being used to power Apple’s iCal program.
In this article, I will run through the basic script setups needed, give a basic introduction to key vCalendar elements, and use PHP to format an example event. By the end, you should be able to share your calendars online.

Should I Use vCalendar or iCalendar?

As with most things in life, it depends. vCalendar has been around longer and enjoys wider adoption. Most software calendaring programs (iCal, Outlook 2000+ for Windows) support both vCalendar and iCalendar, some (Palm Desktop, Outlook 97) support only vCalendar, and a handful (Outlook and Entourage for Macintosh) support only iCalendar. Most of your WAP calendaring applications also support vCalendar.
On the other hand, iCalendar is the format of the future. The Outlook products have picked up iCalendar support and so will the next version of LotusNotes. Apache has default support for iCalendar enabled, but not vCalendar. If you’re developing for vCalendar now, be aware of iCalendar.
Since this is an introductory article, I will be using the vCalendar specification in all of my examples with iCalendar exceptions noted. vCalendar is simpler than iCalendar and the official specifications are much more layman-friendly to read. iCalendar is based on vCalendar sort of like Java is based on C. Therefore, if you want to migrate to iCalendar later, it will be a flatter learner curve.