Calendars for multiple users

From PHPicalWiki

Jump to: navigation, search

It is nice to be able to have multiple websites displaying different calendars for different communities, or for different users. You can use a single copy of phpicalendar to control any number of calendars by using the cpath variable in the parameters passed by the URL. if the URL to your phpicalendar installation is, then can be used to display the calendars for user1, for user2, and so on.


[edit] The Basic Setup

The key to this is that cpath appends a string onto the default calendar path set in If you have not changed this from the default that comes with the released version, then this will be phpicalendar/calendars. However, you can put it anywhere that is accessible to your webserver software. For now, we'll assume that you're using the default. Suppose you have two people in your group, John and Mary. You can create two subdirectories inside phpicalendar: phpicalendar/calendars/John and phpicalendars/Mary. Set these so that John and Mary have write permissions to those directories, as appropriate, and make sure that the directories are readable by all.

You also need so set up tmp/John and tmp/Mary subdirectories, where tmp is the place where you set for saving parsed calendars in

Then you tell John to publish his calendar (I'm assuming you're using WebDAV) using iCal to a private server with the address, and tell Mary to publish her iCal to

That's it!

[edit] Accessing the web calendars

Assuming that John and Mary have successfully published their calendars, they can access them via the URLs: and respectively. Each user can publish as many calendars as they want, and these will show up in the phpicalendar menus. When the users click on different views, phpicalendar will remind itself of the value of cpath, and the user will stay within that collection of calendars.

[edit] Some more advanced tricks

[edit] Placing the default directory outside phpicalendar

On the Mac OSX Server, websites are normally in /Library/WebServer/Documents. The phpicalendar installation on an XServe with the URL would be in the path /Library/WebServer/Documents/phpicalendar. You can move the calendar directory to /Library/WebServer/Documents/calendars. Why bother? Well, there are two reasons (neither is a big deal)

  • You can give John and Mary shorter URLs to type into the publish dialog box
  • If you throw away the whole phpicalendar directory while upgrading to a new version, you won't space out and lose all your calendars (of course, you should be doing backups of your do back up your server, right?)

[edit] Sharing Events

What if you want to have certain events from your group calendar show up on both John's calendars and Mary's calendars. There are a couple of ways to do this. First, you set up a third directory for common events, or just publish a common calendar to the calendars directory. You can view this one by leaving out cpath, just use Then (in unix and linux) you can define a symlink (kind of alias) using these shell commands:

sudo ln -s /Library/WebServer/Documents/calendars/shared.ics /Library/WebServer/Documents/calendars/John/shared.ics 
sudo ln -s /Library/WebServer/Documents/calendars/shared.ics /Library/WebServer/Documents/calendars/Mary/shared.ics 

Whoever updates the shared calendar will also update the web displays of John's calendars and Mary's calendars.

Alternatively, if you specify addresses in the array of webcals defined in, these will show up in all of the different user web displays, no matter what you use for cpath.

[edit] Deeper Nesting

You can organize your users into subdirectories within subdirectories. The cpath variable accepts values like cpath=colleges/arts_and_sciences/history.

[edit] Examples

Here are some web pages that use cpath to display different calendars: