Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Re: [gotze] RSS / XML Output for Ten Most Recent Postings

Quote Reply
Re: [gotze] RSS / XML Output for Ten Most Recent Postings In reply to
1/8/03 UPDATE:
This gizmo is still in-process, since invalid characters are allowed to creep into your xml. See later posting. Back to the orginal posting:

Nice John, I'm testing something similar. This was pieced from other postsings here - which I'm too lazy to credit. It should xml-ize the last ten posts (controlled by hot_threads variable).

This should allow for a short quote of the post to be displayed too.


http://nerock.com/cgi-bin/gforum/gforum.cgi?do=search_results&search_time=10h&t=rssmod

Step 1
Create two new global variables:

hot_threads


sub {
my $tags = shift;
my $post_db = $DB->table ('Post');
$post_db->select_options ('WHERE post_root_id=0',
'ORDER BY post_time DESC', 'LIMIT 10');
my $sth = $post_db->select;
my @output;
while (my $post = $sth->fetchrow_hashref)
{
push @output, $post;
}

return { post_loop => \@output };
}


hot_chop update: see later post below for improved hot_chop


sub {
my $post_message = shift;
return substr($post_message,0,125);
}


Step 2
Create a new directory / template set - called rssmod with two new templates:

.tplinfo


{
inheritance => '../default'
}


search_results.html


<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="0.91">
<channel>
<title>Your Title</title>
<link>http://yousite.com</link>
<description>Your Description</description>
<language>en</language>

<%hot_threads%>
<%loop post_loop%>
<item>
<title><%post_subject%></title>
<link>http://www.yoursite.com/gforum/gforum.cgi?post=<%post_id%></link>
<description><%hot_chop($post_message)%></description>
</item>
<%endloop%>
</channel>
</rss>

Last edited by:

DoubleJJ: Jan 13, 2003, 5:56 PM
Subject Author Views Date
Thread RSS / XML Output for Ten Most Recent Postings DoubleJJ 31829 Nov 18, 2002, 2:56 PM
Thread Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
gotze 31530 Nov 22, 2002, 7:35 PM
Thread Re: [gotze] RSS / XML Output for Ten Most Recent Postings
DoubleJJ 31522 Nov 22, 2002, 9:33 PM
Thread Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
gotze 31582 Nov 23, 2002, 6:04 PM
Post Re: [gotze] RSS / XML Output - strip bad chars?
DoubleJJ 31410 Nov 24, 2002, 10:15 PM
Post Re: [gotze] RSS / XML Output for Ten Most Recent Postings
maxpico 30870 Apr 20, 2003, 7:54 AM
Thread Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
carfac 31266 Jan 8, 2003, 3:18 PM
Thread Re: [carfac] RSS / XML Output for Ten Most Recent Postings
DoubleJJ 31255 Jan 8, 2003, 6:28 PM
Thread Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
carfac 31410 Jan 9, 2003, 8:30 AM
Thread Re: [carfac] RSS / XML Output for Ten Most Recent Postings
DoubleJJ 31186 Jan 9, 2003, 8:42 AM
Post Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
carfac 31281 Jan 9, 2003, 9:09 AM
Post Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
balita 31090 Feb 4, 2003, 6:01 AM
Thread Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
klauslovgreen 31001 Apr 20, 2003, 8:04 AM
Thread Re: [klauslovgreen] RSS / XML Output for Ten Most Recent Postings
gotze 30847 Apr 20, 2003, 8:23 AM
Thread Re: [gotze] RSS / XML Output for Ten Most Recent Postings
klauslovgreen 30860 Apr 20, 2003, 8:29 AM
Thread Re: [klauslovgreen] RSS / XML Output for Ten Most Recent Postings
gotze 30849 Apr 20, 2003, 8:34 AM
Thread Re: [gotze] RSS / XML Output for Ten Most Recent Postings
discusswireless 28988 Jun 8, 2006, 1:27 PM
Thread Re: [discusswireless] RSS / XML Output for Ten Most Recent Postings
gotze 28990 Jun 8, 2006, 1:38 PM
Thread Re: [gotze] RSS / XML Output for Ten Most Recent Postings
discusswireless 28946 Jun 9, 2006, 8:40 AM
Thread Re: [discusswireless] RSS / XML Output for Ten Most Recent Postings
designgroup 10498 Sep 2, 2006, 11:42 PM
Post Re: [designgroup] RSS / XML Output for Ten Most Recent Postings
tandat 10461 Sep 5, 2006, 5:35 AM
Post Re: [discusswireless] RSS / XML Output for Ten Most Recent Postings
Andy 9781 May 13, 2009, 2:04 AM
Thread A RSS Feed that is Filtered
designgroup 10758 Jun 30, 2006, 7:29 PM
Thread Re: [designgroup] A RSS Feed that is Filtered
gotze 10696 Jul 1, 2006, 4:33 AM
Thread Re: [gotze] A RSS Feed that is Filtered
designgroup 10725 Jul 1, 2006, 11:18 AM
Thread Re: [designgroup] A RSS Feed that is Filtered
gotze 10762 Jul 1, 2006, 11:24 AM
Thread Re: [gotze] A RSS Feed that is Filtered
gotze 10717 Jul 1, 2006, 11:27 AM
Post Re: [gotze] A RSS Feed that is Filtered
designgroup 10657 Jul 1, 2006, 11:33 AM
Post Re: [gotze] A RSS Feed that is Filtered
webslicer 10548 Aug 16, 2006, 5:01 AM
Thread Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
carfac 31164 Feb 4, 2003, 10:06 AM
Thread Re: [carfac] RSS / XML Output for Ten Most Recent Postings
DoubleJJ 31142 Feb 4, 2003, 10:16 AM
Thread Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
carfac 31187 Feb 4, 2003, 10:51 AM
Thread Re: [carfac] RSS / XML Output for Ten Most Recent Postings
DoubleJJ 31141 Feb 4, 2003, 11:12 AM
Thread Re: [DoubleJJ] RSS / XML Output for Ten Most Recent Postings
carfac 31117 Feb 4, 2003, 12:04 PM
Post Re: [carfac] RSS / XML Output for Ten Most Recent Postings
maxpico 31053 Feb 20, 2003, 5:51 AM