damo66a Posted May 13, 2011 Posted May 13, 2011 Hi there. I have the need to be able to create an rss feed fed from a shared calendar. I found a bit of php that apparently does the job but Im some what at a loss as to how to get it working. Its called ical2rss and is widely available if you search. Lets say I cant get that to work for whatever reason, is there something out there that will allow me to import an .ics calendar and be able to make an rss feed from it. I can find everything under the sun about doing the other way round but I not this way. Any one got any ideas as to how i can go forward with this? Apologies if its in the wrong place.
supportman Posted October 10, 2018 Posted October 10, 2018 Just come up against this myself for our digital signage integration. Does anyone have any more modern solutions?
mavhc Posted October 10, 2018 Posted October 10, 2018 Seems like there's not much out there, let's get the one you have working, what's the error?
supportman Posted October 10, 2018 Posted October 10, 2018 I think Xibo now supports ical extensions which may negate the need to convert to RSS. I'll update if I can get it working. https://community.xibo.org.uk/t/calendar-module-guide-xibo-cms-1-8-10/14749
supportman Posted October 11, 2018 Posted October 11, 2018 (edited) I found it actually easier to use a little PHP function to sort the ical into an array, luckily the structure is pretty easy to parse. function icsToArray($paramUrl) { $icsFile = file_get_contents($paramUrl); $icsData = explode("BEGIN:", $icsFile); foreach($icsData as $key => $value) { $icsDatesMeta[$key] = explode("\n", $value); } foreach($icsDatesMeta as $key => $value) { foreach($value as $subKey => $subValue) { if ($subValue != "") { if ($key != 0 && $subKey == 0) { $icsDates[$key]["BEGIN"] = $subValue; } else { $subValueArr = explode(":", $subValue, 2); $icsDates[$key][$subValueArr[0]] = $subValueArr[1]; } } } } return $icsDates; } And then to show the latest 5 events with a summary $events = icsToArray('calendar/1.ics'); //$events = icsToArray("https://outlook.office365.com/owa/calendar/youroffice365livelinkhere/reachcalendar.ics"); $counter = 0; // Loop through 5 events foreach($events as $event){ // Check the event summary is not null and display if ($event['SUMMARY'] != '') { // Define the strings $date = NULL; $summary = NULL; $date = $event['DTSTART;VALUE=DATE']; $date = substr_replace($date, '-', 4, 0); $date = substr_replace($date, '-', 7, 0); $summary = $newstr = str_replace('\\','', $event['SUMMARY']); // Display each events echo ""; echo " "; echo "".$date.""; echo " "; echo $summary.""; // Count up each time we find a valid event $counter++; } // Break out of the loop if we have more than 5 events if ($counter > 5) { Break; } } Edited October 11, 2018 by supportman
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now