I've never done it myself, and I've never subscribed to a feed, but it seems that I'm going to have to create one, so I'm wondering. The only way that seems apparent to me is that when the system is updated with a new item (blog post, news item, whatever), a new element should be written to the rss file. Or alternatively have a script that checks for updates to the system a few times a day and writes to the rss file is there is. There's probably a better way of doing it though.
And also, should old elements be removed as new ones are added?
Edit: I should have mentioned, I'm working in PHP, specifically using CodeIgniter, with a mySQL database.
For PHP I use feedcreator http://feedcreator.org/
<?php define ('CONFIG_SYSTEM_URL','http://www.domain.tld/');
require_once('feedcreator/feedcreator.class.php');
$feedformat='RSS2.0';
header('Content-type: application/xml');
$rss = new UniversalFeedCreator();
$rss->useCached();
$rss->title = "Item List";
$rss->cssStyleSheet='';
$rss->description = 'this feed';
$rss->link = CONFIG_SYSTEM_URL;
$rss->syndicationURL = CONFIG_SYSTEM_URL.'feed.php';
$articles=new itemList(); // list of stuff
foreach ($articles as $i) {
$item = new FeedItem();
$item->title = sprintf('%s',$i->title);
$item->link = CONFIG_SYSTEM_URL.'item.php?id='.$i->dbId;
$item->description = $i->Subject;
$item->date = $i->ModifyDate;
$item->source = CONFIG_SYSTEM_URL;
$item->author = $i->User;
$rss->addItem($item);
}
print $rss->createFeed($feedformat);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With