Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Category RSS Feeds...

Quote Reply
Category RSS Feeds...
I want to set up RSS feeds for each of my directory categories, New Links area, etc. so people can subscribe to a particular category to monitor newly added links.

Does anyone have a step-by-step on how to do this or is there a plug-in or global to accomplish this?

Thanks a lot.

mgeyman
Quote Reply
Re: [mgeyman] Category RSS Feeds... In reply to
I'm personally using the PageBuilder plugin to create such feeds, but if you are not picky about everything, you can just use the old XML-plugin, and specify search string with catid=NN for category feeds, isNew=Yes for a feed with new links. etc.
Quote Reply
Re: [mgeyman] Category RSS Feeds... In reply to
You can do it with a global - this is for the new links in a category:

sub {
my $id=shift;
my $cattable=$DB->table('Links','CatLinks');
$cattable->select_options('ORDER BY Add_Date DESC','LIMIT 10');
my $sth = $cattable->select({CategoryID=>$id},VIEWABLE);
my @loop;
while (my $hit = $sth->fetchrow_hashref()) {
push @loop, $hit;
}
return {Links_Loop=>\@loop};
}

This is another global for general info about the category (optional I think):

sub {
my $id=shift;
my $table = $DB->table('Category');
my $link = $table->select({ID=>$id})->fetchrow_hashref;
return {%$link};
}

Then a new template something like this (please feel free to make comments on this as I'm not an rss expert)

<?xml version="1.0" encoding="iso-8859-1" ?>
<rss version="2.0">
<%get_cat_info($ID)~%>
<%get_catlinks($ID)~%>
<%set pubdate=$Links_Loop.0.Add_Date~%>
<channel>
<title>New Sites in <%Name%> on <%site_title%></title>
<description>This is a feed of the latest listings in <%Name%> on <%site_title%></description>
<link>http://www.yourdomain.com/cgi-bin/page.cgi?p=newtemplatename</link>
<pubDate><%GT::Date::date_transform($pubdate,"%yyyy%-%mm%-%dd%","%ddd%, %dd% %mmm% %yyyy% %hh%:%MM%:%ss% GMT")%></pubDate>
<image>
<url>http://www.yourdomain.com/logo.jpg</url>
<title><%site_title%></title>
<link>http://www.yourdomain.com/cgi-bin/page.cgi?p=newtemplatename</link>
<description>Description of your site</description>
<width>100</width>
<height>60</height>
</image>
<%loop Links_Loop%>
<item>
<title><%escape_html Title%></title>
<description><%escape_html Description%></description>
<link>http://www.link.to.detailed.page</link>
<guid isPermaLink="true">http://www.link.to.detailed.page</guid>
<pubDate><%GT::Date::date_transform($Add_Date,"%yyyy%-%mm%-%dd%","%ddd%, %dd% %mmm% %yyyy% %hh%:%MM%:%ss% GMT")%></pubDate>
</item>
<%endloop%>
</channel>
</rss>