Welcome to Geeklog Monday, May 20 2019 @ 10:28 pm EDT

Geeklog Forums

Auto Generated RSS Feed Block


Status: offline

grant

Forum User
Junior
Registered: 14/12/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/
PHP 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 .'">&nbsp;&nbsp;<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.

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
Shouldn't you read this info from the syndication table?

Status: offline

grant

Forum User
Junior
Registered: 14/12/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.

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/05
Posts: 985
In this case that works. But only because Feeds are not controlled by permissions.

Status: offline

grant

Forum User
Junior
Registered: 14/12/05
Posts: 21
Location:Iowa City, IA
Ah didn't think about that, good to remember for future reference.

Status: offline

trampoline

Forum User
Full Member
Registered: 24/02/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 ???

Status: offline

THEMike

Forum User
Moderator
Registered: 25/07/03
Posts: 141
Location:Sheffield, UK
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.

Status: offline

trampoline

Forum User
Full Member
Registered: 24/02/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 ?

Status: offline

THEMike

Forum User
Moderator
Registered: 25/07/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.

Status: offline

trampoline

Forum User
Full Member
Registered: 24/02/06
Posts: 392
Will it actually archive the article ? pictures text etc ... ?

Status: offline

THEMike

Forum User
Moderator
Registered: 25/07/03
Posts: 141
Location:Sheffield, UK
If the full article is in the feed, then yes.

Status: offline

trampoline

Forum User
Full Member
Registered: 24/02/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 ?

Status: offline

THEMike

Forum User
Moderator
Registered: 25/07/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.

All times are EDT. The time is now 10:28 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