Description:
This is the companion to rss_export. I created this box to encourage people using feeds to stick around and browse the site rather then leech. I figure if they see the story the RSS feed gives them, plus two more stories, they are more likely to check out the rest of the site.
If you are using (and you probably are) the extended body, you'll probably want to modify this code. I'd imagine you'd show the entire body, it's comments and below that you'd show the summaries of two more stories.
Since I suck, there is probably some photographica specific stylesheet stuff you'll want to pull out as well (like that div crap down there...).
Box Code:
my $content;
my $sid=$S->{CGI}->param('sid');
my $ssid=$S->{DBH}->quote($sid);
return "" unless $sid;
my ($rv, $sth) = $S->db_select({
WHAT=>'*',
FROM=>'stories',
WHERE=>"sid=$ssid",
DEBUG=>0
});
my $story=$sth->fetchrow_hashref();
my $aid = $S->{DBH}->quote($$story{aid});
$content = $S->displaystory($sid, $story);
# clearly you'll want to change this...
$content .= qq(<div class="box_head">Other Photographica Members:</div>);
$sth->finish;
$sth=undef;
($rv, $sth) = $S->db_select({
WHAT=>'*',
FROM=>'stories',
WHERE=>"aid != $aid",
ORDER_BY=>'time DESC',
LIMIT=>'2',
DEBUG=>0
});
while(my $extra_story = $sth->fetchrow_hashref())
{
$content .= $S->story_summary($extra_story);
}
$content .= "<a href='/'>View the rest...</a>";
return $content;
|