Gossamer Forum
Quote Reply
Outbound RSS Feed
Is there any plugin or other means of generating an RSS feed from Links? We would like to feature the newest links on our institutional site and our news site.
Quote Reply
Re: [Giray] Outbound RSS Feed In reply to
There is no such plug-in yet (as far as I know), but if there was, it would be awesome.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Outbound RSS Feed In reply to
Use the xml plugin and write the xml template accordingly.
Quote Reply
Re: [Giray] Outbound RSS Feed In reply to
I'm using a self made RSS feed on my site. Perhaps this might be of interest for you. Since I'm gathering computer games you will need to customize the feed and the global to load the data you need on your site. I've stripped out most of my own modifications in the code examples and thus this code here is not fully tested. ;-)

If you have any questions don't hesitate to ask. You can see the working code on http://www.games-release.de/.

1. Create a template 'rdf_template.html' for the feed.

Code:
<%~load_new_links~%>
<?xml version="1.0" encoding="ISO-8859-1"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://my.netscape.com/rdf/simple/0.9/">

<channel>
<title>Title of your site</title>
<link>http://www.url-of-your-site.org/</link>
<description>Description of your site</description>
</channel>

<%loop links_loop%>
<item>
<title><%Add_Date%> - <%Title%></title>
<link><%config.build_detailed_url%>/<%ID%>.html</link>
</item>
<%endloop%>
</rdf:RDF>

2. Create a template global (load_new_links in this example).

Note: you may alter this completely to suit your needs. I'm using a raw SQL query scheme in this one.

Code:
sub {
my $db = $DB->table('Links');
my $sql = 'SELECT * FROM glinks_Links WHERE isNew = "Yes"';
$sql .= ' ORDER BY Add_Date ASC, Title ASC';
my $sth = $db->prepare($sql);
$sth->execute();
my $rows = $sth->fetchall_hashref;
my @results;
for my $row (@$rows) {
push @results, $row;
}
return {
links_loop => \@results
}
}

3. Creating an Apache rewrite rule.

This one will let your dynamic page look like a static RDF file.

Code:
RewriteEngine on
RewriteRule ^/path-to-your-rdf-file/your-file.rdf /cgi-bin/page.cgi?p=rdf_template [L,NC]
Quote Reply
Re: [Volker] Outbound RSS Feed In reply to
Thanks Volker. I'm going to get our sysadmin to look at it to see if he can make use of it.

Gossamer... what do you think? A good feature to add to the core?
Quote Reply
Re: [Giray] Outbound RSS Feed In reply to
how its possible to create this rss feed based on category ID?
for example i have 100 new links a day.
10 links are in cat
30 links are in catB
etc.
and i want to have rss news links for very category.

site.com/cata-news.rss
site.com/catb-news.rss
etc.

please help.
Quote Reply
Re: [hmc] Outbound RSS Feed In reply to
If you know the categories you can use this code. It's quick and dirty and I have not tested it. Modify load_new_links(123) and set it to the category id you want to be fetched. Same for load_new_links(987).

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://my.netscape.com/rdf/simple/0.9/">

<channel>
<title>Title of your site</title>
<link>http://www.url-of-your-site.org/</link>
<description>Description of your site</description>
</channel>

<%~load_new_links(123)~%>
<%loop links_loop%>
<item>
<title><%Add_Date%> - <%Title%></title>
<link><%config.build_detailed_url%>/<%ID%>.html</link>
</item>
<%endloop%>
<%~load_new_links(987)~%>
<%loop links_loop%>
<item>
<title><%Add_Date%> - <%Title%></title>
<link><%config.build_detailed_url%>/<%ID%>.html</link>
</item>
<%endloop%>
</rdf:RDF>

Code:
sub {
my $cat_id = shift || return;
my $db = $DB->table('Links');
my $sql = 'SELECT * FROM glinks_Links AS l, glinks_CatLinks AS c WHERE l.isNew = "Yes"';
$sql .= ' AND l.ID = c.LinkID';
$sql .= ' AND c.CategoryID = ' . $cat_id;
$sql .= ' ORDER BY l.Add_Date ASC, l.Title ASC';
my $sth = $db->prepare($sql);
$sth->execute();
my $rows = $sth->fetchall_hashref;
my @results;
for my $row (@$rows) {
push @results, $row;
}
return {
links_loop => \@results
}
}
Quote Reply
Re: [hmc] Outbound RSS Feed In reply to
In my GotzeTagged I offer three flavors of feeds from categories: RSS 2.0, RDF/RSS 1.0 and OPML. I use the PageBuilder plugin to create the feeds. This also allows you to set proper http headers (application/rss+xml).

John