Posted on: 04/18/07 06:46am
By: grant
This is a php block that displays the various rss feeds in your backend folder and lists links to the files similar to the block on the geeklog.net homepage. The advantage is if you add or remove a feed you don't have to update the block manually.
All you need to do is set $ext to the file extension of your feeds, and get a suitable feed icon if you want.
http://www.feedicons.com/[*1]
Text Formatted Code
function phpblock_feeds( ){
global $_CONF;
$directory = opendir( $_CONF['path_html'] . '/backend/');
$url = $_CONF['site_url'] . '/backend/';
$ext = '.xml'; //set to proper file extension .rss, .rdf, whatever
while(false !== ($file = readdir($directory))) {
$pos = strstr($file, $ext);
if ($pos !== false) {
$pieces = explode($ext,$file);
$docname = $pieces[0];
$output .= '
<img src="'. $_CONF['site_url'] . '/images/buttons/feed.png" alt="RSS Feed of '. $_CONF['site_name'] .' '. $docname .'"> <a href="'. $url . $docname . $ext .'" type="application/rss+xml" title="Subscribe to RSS Feed of '. $_CONF['site_name'] .' '. $docname .'">'. $docname .'</a><br>';
}
}
closedir($directory);
return $output;
}
Edit: whoops put this in the wrong forum, please move, thanks.
Re: Auto Generated RSS Feed Block
Posted on: 04/18/07 11:18am
By: jmucchiello
Shouldn't you read this info from the syndication table?
Re: Auto Generated RSS Feed Block
Posted on: 04/18/07 01:51pm
By: grant
Yeah that would work. The only advantage to directory listing is there is no possibility of a 404 error if the syndication file doesn't get generated. I figure the fewer db queries the better right?
Thanks.
Re: Auto Generated RSS Feed Block
Posted on: 04/18/07 01:59pm
By: jmucchiello
In this case that works. But only because Feeds are not controlled by permissions.
Re: Auto Generated RSS Feed Block
Posted on: 04/19/07 04:05am
By: grant
Ah didn't think about that, good to remember for future reference.
Re: Auto Generated RSS Feed Block
Posted on: 04/23/07 04:18pm
By: trampoline
All you need to do is set $ext t
$ext = '.xml'; //set to proper file extension .rss, .rdf, whatever
[/p]
where do you put $ext ???
also what do we change for the .xml line ???
Re: Auto Generated RSS Feed Block
Posted on: 05/10/07 10:43am
By: THEMike
I'd like to see the two approaches combined, use the syndication table, but only display a link if the file actually exists. Then you can also label the feed accurately.
Re: Auto Generated RSS Feed Block
Posted on: 05/10/07 11:07am
By: trampoline
I would like to download an RSS FEED so that articles are downloaded and kept rather than just a link displayed which can disappear.
So I would like to archive a portal block feed, I don't suppose this is achievable in Geeklog ? if not is there any program that can archive an RSS feed ?
Re: Auto Generated RSS Feed Block
Posted on: 05/10/07 11:24am
By: THEMike
There are /loads/ of different RSS readers on the market that will monitor a feed on a polling basis and keep a history of everything as it changes over time. Personally, I used to use bloglines (online tool) but have switched to Google Reader (online tool). My preferred desktop client was once RSS Bandit, but I prefer an online tool these days.
Re: Auto Generated RSS Feed Block
Posted on: 05/10/07 11:25am
By: trampoline
Will it actually archive the article ? pictures text etc ... ?
Re: Auto Generated RSS Feed Block
Posted on: 05/10/07 11:31am
By: THEMike
If the full article is in the feed, then yes.
Re: Auto Generated RSS Feed Block
Posted on: 05/10/07 11:33am
By: trampoline
Quote by: THEMikeIf the full article is in the feed, then yes.
which you could then save on your site and search ?
Re: Auto Generated RSS Feed Block
Posted on: 05/10/07 11:39am
By: THEMike
Depends on the software you use and what format it's database of feed content is in. I guess the backend is likely to be XML, so you could write something to upload this into your GL site.
I think what you are more likely looking for is a full feed aggregator built into geeklog, I am not aware of any plugins that do this, and would think that that's a dubious application to build, because the feed sources may not like you effectively re-publishing their content on your site. If it's for personal use, something like google reader/bloglines/a desktop client should be just fine for you. If it's to re-publish other's content, think again, that's a bad idea.