RSS from Mysql Database
Does anybody have a script for creating an rss feed from a mysql databsae?
having created a noticeboard staff can submit to i would like to be able to create an rss feed from it (scheduled cron job maybe) then have our Xibo boxes display the RSS feed.
EDIT: can a mod put PHP infront of this please!
It should be pretty straight-forward. Cron isn't needed if you point Xibo at a PHP file that simply outputs the RSS dynamically-generated from the DB.
You just need to retrieve some articles from the DB, and instead of displaying them in HTML format like you might do already, just output the correct XML tags and HTTP header.
Here's something to get you started.
// Correct RSS XML header
// get your items from the DB (replace with your own code to get stuff from DB)
$notices = get_from_db();
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
<description>Staff notice board messages</description>
<?php foreach($notices as $notice): ?>
<title><?php echo $notice['title'] ?></title>
<description><?php echo $notice['body'] ?></description>
<guid><?php echo $notice['id'] ?></guid>
<pubDate><?php echo date(DATE_RSS, strtotime($notice['time'])) ?></pubDate>
<?php endforeach; ?>
Cheers webman i'll give it a go!