Solved

RSS Feed import to other Calendar apps

Posted on 2011-02-22
5
2,425 Views
Last Modified: 2014-11-12
I have an RSS feed that is based on an internal calendar database app.

What's the best way to have people import that RSS feed into their own calendars regardless of what app they are using i.e. MS Outlook, Google Calendar, Lotus Notes etc...
I have attached the RSS feed page image.
calendar-rss-feed.bmp
0
Comment
Question by:awarraic
  • 3
  • 2
5 Comments
 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 34961030
That's a good question and I have never tried to make an RSS feed into a calendar application - they are just two separate things.  However there may be a way by providing a link to a vCal file.

The <item> tag has a place for a link.
http://cyber.law.harvard.edu/rss/rss.html#hrelementsOfLtitemgt

This link could point to a script on your calendar application that generates a little vcal file, something like this.  The script is in the code snippet.
http://www.nationalpres.org/NPC_calendar_vcal.php?k=2945

Sorry it's not very pretty (legacy code from many years ago) but it works for our needs.

HTH, ~Ray
<?php // http://www.NationalPres.org/NPC_calendar_vcal.php
error_reporting(E_ALL ^ E_NOTICE);
$config_page = $_SERVER["DOCUMENT_ROOT"] . '/' . 'config.php';             require_once($config_page);
$cal_funcs   = $_SERVER["DOCUMENT_ROOT"] . '/' . 'calendar_functions.php'; require_once($cal_funcs);
if (bad_robots()) { die(); }



$_key        = $_GET["k"];
if (!is_clean_numeric_string($_key)) die("Bad Key");

$filename = "NPCEvent" . $_key . ".vcs";
header("Content-Type: text/x-vCalendar");
header("Content-Disposition: inline; filename=$filename");


$sql = "SELECT * FROM $calendar_table WHERE _key = $_key LIMIT 1 ";
if (!$result = mysql_query($sql)) { fatal_error($sql); }
$num_rows = mysql_num_rows($result);

if ($num_rows == 0) {
    echo "Sorry, the <b>Event Key $_key</b> is not found in the $calendar_table data base.<br /><br />\n";
    echo "Please report this error to the NPC Communications Office.<br /><br />\n";
    die("Sorry, Unable to add to your calendar.");
}
if ($num_rows != 1) {
    echo "SQL $sql<br>";
    echo "RESULT $result<br><br>";
    echo "The <b>Event Key $_key</b> appears to have $num_rows data base entries in $calendar_table (yikes!)<br />\n";
    echo "Please report this error to the NPC Communications Office.<br /><br />\n";
    die("Sorry, Unable to add to your calendar.");
}

$calendar_array = mysql_fetch_assoc($result); 

extract($calendar_array);

$loc = trim($location);
if ($loc  != '') { $loc = '=0D=0A=Location: ' . $loc; }

$poc1 = trim($poc1_name .' '. $poc1_phone .' '. $poc1_email);
if ($poc1 != '') { $poc1 = '=0D=0A=Contact: ' . $poc1; }

$poc2 = trim($poc2_name .' '. $poc2_phone .' '. $poc2_email);
if ($poc2 != '') { $poc2 = '=0D=0A=Contact: ' . $poc2; }

$pocw = trim($poc_url);
if ($pocw != '') { $pocw = '=0D=0A=WWW: ' . $pocw; }

$poc = $poc1 . $poc2 . $pocw;

// CALENDAR TOLERATES END TIMESTAMPS WRONG OR OMITTED - VCAL DOES NOT
$vcal_dtstart = date('Y-m-d\TH:i:sO', strtotime($start . " -1 hour"));
$vcal_dtend   = date('Y-m-d\TH:i:sO', strtotime($end . " -1 hour"));
if ($vcal_dtend < $vcal_dtstart) { $vcal_dtend = $vcal_dtstart; }


?>BEGIN:VCALENDAR
VERSION:1.0
PRODID:NPC Online Calendar
BEGIN:VEVENT
SUMMARY:<?php echo "$title" . PHP_EOL; ?>
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:<?php echo "$details" . "$loc" . "$poc" . PHP_EOL; ?>
DTSTART:<?php echo $vcal_dtstart . PHP_EOL; ?>
DTEND:<?php echo $vcal_dtend . PHP_EOL; ?>
END:VEVENT
END:VCALENDAR

Open in new window

0
 

Author Comment

by:awarraic
ID: 34974134
@Ray, how does this code work?
Do I have to add config.php and calendar.php files?
What's the $_key?
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34974761
No, you do not have to add the config or calendar scripts from our framework - just substitute your own versions.  The only thing this script calls from the framework are error handlers, etc.  Should be pretty easy to figure out.

$_key is the key number for the row in the calendar table.  See line 9 where it is acquired and line 17 where it is used.
0
 

Author Closing Comment

by:awarraic
ID: 34979245
Thanks Ray. First time I heard about this Vcal thing, pretty cool. Once I created .ics file; I just dragged and dropped into lotus notes and all the events were in :)
Thanks again for all the help.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 34983979
Thanks for the points.  I love the vCal.  There is a more advanced version of the standard now, but the older standard works perfectly and never confuses anyone.  Best regards, ~Ray
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Working with spreadsheets can be a daunting task, especially when having to deal with large amounts of data. All you see are rows and rows of numbers and soon your eyes begin to glaze over. Take advantage of the tools in Google Sheets to create prof…
Learn about cloud computing and its benefits for small business owners.
This Micro Tutorial will demonstrate importing calendar invites from events such as webinars into your Google Calendar.
This Micro Tutorial demonstrates how to quickly find related content for YourTango's posts using MozBar Chrome extension.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now