Good evening,
We currently have a large event/calendar repository on our web site, which was programmed in-house. We are interested in dumping these events into .ics files on our public web site, so people can import into their MS Outlook, Google Calendar, iCalendar, etc.
Ideally, I was hoping that we could create these dynamically through PHP on each event details page... I'm just not sure how we can do this :-)
Does anyone know what would be required to perform such a task? Since I understand this may be a very broad question, if anyone could at least point me in the right direction I'd greatly appreciate the help!
Thank you,
JR
Last edited by hollywoodjrc; 08-10-2008 at 12:12 AM.
Ok, here's what I've found. It will be some what simple to program.
a very basic ics file looks like this:
Code:
BEGIN:VCALENDAR
PRODID:TestCal
X-WR-CALNAME:TestCal
X-WR-CALDESC:TestCal
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTART:20080819
DTEND:20080819
LOCATION:Location
UID:2
URL:http://mydomain.com
DESCRIPTION:Put a description here :D
SUMMARY:Title here
END:VEVENT
END:VCALENDAR
This file has a simple 1 day long event for 08-19-2008.
to make the file in this manner it would require knowing the date start, date end, location, url(optional), description, and summery. Just pull this data from the mysql server and put it in the variables needed, then loop through all your events and make the file dynamically.
------------------------
Now when it comes to specific times it gets a little more in depth... as you need to tell the software what time zone you are referring to when specifying times. an example of the same file but with the time from 12am to 1am is here:
Code:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Microsoft Corporation//Windows Calendar 1.0//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Central Time (US & Canada)
BEGIN:STANDARD
DTSTART:20001029T020000
RRULE:FREQ=YEARLY;UNTIL=20061029T080000Z;BYDAY=-1SU;BYMONTH=10
TZNAME:Central Standard Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0600
END:STANDARD
BEGIN:STANDARD
DTSTART:20071104T020000
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=11
TZNAME:Central Standard Time
TZOFFSETFROM:-0500
TZOFFSETTO:-0600
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20000402T020000
RRULE:FREQ=YEARLY;UNTIL=20060402T080000Z;BYDAY=1SU;BYMONTH=4
TZNAME:Central Daylight Time
TZOFFSETFROM:-0600
TZOFFSETTO:-0500
END:DAYLIGHT
BEGIN:DAYLIGHT
DTSTART:20070311T020000
RRULE:FREQ=YEARLY;BYDAY=2SU;BYMONTH=3
TZNAME:Central Daylight Time
TZOFFSETFROM:-0600
TZOFFSETTO:-0500
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DESCRIPTION:Put a description here :D
DTSTART;TZID=Central Time (US & Canada):20080819T000000
DTEND;TZID=Central Time (US & Canada):20080819T010000
LOCATION:Location
SUMMARY:Title here
UID:2
URL:http://mydomain.com
END:VEVENT
X-WR-CALNAME:TestCal
X-WR-CALDESC:TestCal
END:VCALENDAR
This is going to take a little bit of work in php but it can be done fairly easily.
Bookmarks