Americas

  • United States

Put PHP on your iCalendar

Opinion
Jan 26, 20043 mins
Enterprise Applications

* Calendaring with PHP iCalendar

In my quest to find a good Web calendaring application for my son’s school Web site, I have looked at dozens of solutions ranging from the simple, limited, and incredibly ugly, to the remarkably complex and sophisticated, everything-but-the-kitchen-sink and the absolutely gorgeous. Not surprisingly, simple equals free or cheap while complex equates to prices that make your eyes water.

But nothing fitted the bill until I stumbled across PHP iCalendar (see links below) a freeware, open source project under Sourceforge. PHP iCalendar is (as you might guess) written in PHP and is actually a parser for iCal formatted files based on v2.0 of the IETF RFC2445 specification, “RFC2445 Internet Calendaring and Scheduling Core Object Specification (iCalendar).”

PHP iCalendar displays iCalendar (also called “iCal”) files with day, week, month, and year navigation, and associated task list, and provides a printer-formatted view, an RSS link, and can be searched. It also supports 12 languages, is “theme-able” (a.k.a. skinnable), and has time zone support.

Getting PHP iCalendar running is fairly easy although the project’s notes are a little thin and illogically laid out (I always foolishly expect installation instructions to come first and be sequential). There’s also an odd problem with the download file: It is a gzipped Tar file but the content, a single file, doesn’t have an extension – under Windows you’ll need to extract it, rename it with the extension .tar and open it with a WinZip or similar.

Now just unpack preserving the directory structure and FTP it to your Web server where you must, of course, have PHP running. I renamed the top folder of the application to “phpical” as typing “phpicalendar-1.0” is far more work than I want to do.

It is most important that you get the file and directory permissions correct – my hosting provider made this tricky by requiring that you use their Web-based FTP service to modify permissions. The problem was that my FTP client reported the permissions to be unchangeable and defaulting to 777 (rwxrwxrwx) which should have worked – turns out that the hosting service somehow makes this appear to be the case whereas the default is actually 444 (r-r-r–). Oh well.

You’ll need to modify the parameters in the config.inc.php file (in the top most subdirectory) to at least set $default_path (where the top most directory can be found) and optionally enabled admin access and configure authentication.

All other things being right, PHP iCalendar should run, picking up the iCalendar formatted files in the calendar subdirectory and formatting them beautifully – it really is one of the nicest calendar displays I’ve seen. You can choose from the interface to view one or multiple calendars’ data at the same time. If you click on a scheduled item a pop-up will be displayed with the title and any additional item details.

To generate the calendar data files you will probably want to export a calendar from something like Outlook for which you’ll need a tool like Outport. But be sure to test the translation to iCal format carefully as there appears to be minor incompatibilities between Microsoft’s implementation of iCalendar and the RFC2445 spec that make some (but not all) recurring appointments be incorrectly placed in the PHP iCalendar display.

I’m now looking for alternative ways to create iCal-formatted files – ideally being able to map from a CSV file would be ideal … let me know if you find anything.

mark_gibbs

Mark Gibbs is an author, journalist, and man of mystery. His writing for Network World is widely considered to be vastly underpaid. For more than 30 years, Gibbs has consulted, lectured, and authored numerous articles and books about networking, information technology, and the social and political issues surrounding them. His complete bio can be found at http://gibbs.com/mgbio

More from this author