Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RSS Feed import to other Calendar apps

Posted on 2011-02-22
5
Medium Priority
?
2,875 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 111

Accepted Solution

by:
Ray Paseur earned 2000 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 111

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 111

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the encryption capabilities built into Google Apps and how these features can help you meet privacy policy and regulatory compliance, but are not a full solution. Understand and compare the most popular email encryption services for Google A…
First of all let me say that the only language that I speak is English, but in answering questions here I often come across people whose English skills are not the best and I’d like to be able to communicate better with them, and the following descr…
This Micro Tutorial will demonstrate the easy use of Gmail embedding images in your email so the recipient of your email can view them in context.
This Micro Tutorial will demonstrate how marketers can use the Mobile Emulation Tool in Chrome Developer Tool. This will let you preview your site on any mobile device.
Suggested Courses

963 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