Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
Scoop Box Exchange - Show Box: rss_export 1.00

Author: coryking [Info]

Description:

This box will export, in real time, the last 10 stories from a user. Clearly you'll have to clean the photographica crud out and replace it with your own. You'll also have to create an op and assign it to this box (preferably rss_export), you'll also want to make sure the template you use is completly blank besides the content this guy returns. I suggest its companion, rss_story; a story display that will show a story's contents, and two other stories from the site.

Box Code:

use XML::RSS;

my $uid = $S->{DBH}->quote($S->{CGI}->param('user_id'));

my ($rv, $sth) = $S->db_select({
WHAT=>'*',
FROM=>'users',
WHERE=>"uid=$uid"});

my $user = $sth->fetchrow_hashref();

return "" unless($$user{nickname});

# 2.0 is awesome too ya know!
my $rss = new XML::RSS (version => '1.0');

# modify for your own site.
$rss->channel(
title => "Photographica: $$user{nickname}",
link => "http://www.photographica.org",
description => "$$user{nickname}'s last 10 Photographica stories",
);


# if you so desired, you could limit this down to just diaries or something...
($rv, $sth) = $S->db_select({
WHAT=>'sid, title, story_picture',
FROM=>'stories',
WHERE=>"aid='$$user{nickname}'",
ORDER_BY=>'time DESC',
LIMIT=>'10'
});

while(my $story=$sth->fetchrow_hashref())
{

# change this link to /story/$$story{sid} if you so desire
$rss->add_item(
title=>$$story{title},
link=>"http://www.photographica.org/rss_story/?sid=$$story{sid}"
);
}

return $rss->as_string();
Display: Sort:
Errr (none / 0) (#1)
by coryking on Tue Nov 28, 2006 at 07:58:15 PM PST

Hmmmm.... Linebreaks are screwy. I'm gonna try one more time here.

--
Cory R. King
xlan.org (scoop hosting)
photographica (pictures)



  • okay by coryking, 11/28/2006 07:59:53 PM PST (none / 0)
Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Smokedot
It's 4:19... do you know where your bong is?

Login
Make a new account
Username:
Password:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search