Welcome to Geeklog, Anonymous Thursday, November 21 2024 @ 09:10 pm EST
Geeklog Forums
Auto Generated RSS Feed Block
Status: offline
grant
Forum User
Junior
Registered: 12/14/05
Posts: 21
Location:Iowa City, IA
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/
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.
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/
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.
16
15
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
Shouldn't you read this info from the syndication table?
9
15
Quote
Status: offline
grant
Forum User
Junior
Registered: 12/14/05
Posts: 21
Location:Iowa City, IA
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.
Thanks.
14
13
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
In this case that works. But only because Feeds are not controlled by permissions.
16
17
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
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 ???
12
15
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
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 ?
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 ?
11
17
Quote
Status: offline
THEMike
Forum User
Moderator
Registered: 07/25/03
Posts: 141
Location:Sheffield, UK
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.
14
16
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
Will it actually archive the article ? pictures text etc ... ?
10
15
Quote
Status: offline
trampoline
Forum User
Full Member
Registered: 02/24/06
Posts: 392
Quote by: THEMike
If the full article is in the feed, then yes.
which you could then save on your site and search ?
12
12
Quote
Status: offline
THEMike
Forum User
Moderator
Registered: 07/25/03
Posts: 141
Location:Sheffield, UK
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.
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.
15
14
Quote
All times are EST. The time is now 09:10 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content