Description:
This displays the latestn stories from
each section. It also displays a list of the latest
15 or so diaries. Edit the box to get it to show
the sections you need it to.
Box Code:
my $content = qq{
<!-- all sections link -->
<B><A HREF="|rootdir|/section/__all__" style="text-decoration:none;"><font color="#000000">All Stories</font></A></B>
<P>};
my $refresh = $S->cache->{CACHE}->{section_stories_num} \|\| 101;
#order sections
my @sections = qw(
tech
culture
fnp
media
news
internet
op-ed
mlp
Meta
columns );
if ($refresh > 100) {
$S->cache->{CACHE}->{section_stories_num} = 1;
$S->cache->{CACHE}->{section_stories} = {};
foreach my $section (@sections) {
next if ($section eq 'front');
$content .= qq{
<B><A HREf="|rootdir|/section/$section" style="text-decoration:none;"><font color="#000000">$S->{SECTION_DATA}->{$section}->{title}</font></A>:</B>
<BR>|smallfont|};
my ($rv, $sth) = $S->db_select({
WHAT => 'sid, title',
FROM => 'stories',
WHERE => qq{section = "$section" AND displaystatus = 1},
ORDER_BY => 'time DESC',
LIMIT => 3});
while (my $story = $sth->fetchrow_hashref()) {
push @{$S->cache->{CACHE}->{section_stories}->{$section}}, $story;
my $comments = $S->_commentcount($story->{sid});
$content .= qq{
|dot| <A HREF="|rootdir|/story/$story->{sid}">$story->{title}</A><br>($comments comments)<BR>}; #|
}
$content .= qq{
|dot| <A HREf="|rootdir|/section/$section">more >></A>
|smallfont_end|
<P>};
}
} else {
$S->cache->{CACHE}->{section_stories_num} += 1;
foreach my $section (@sections) {
next if ($section eq 'front');
$content .= qq{
<B><A HREf="|rootdir|/section/$section" style="text-decoration:none;"><font color="#000000">$S->{SECTION_DATA}->{$section}->{title}</font></A>:</B>
<BR>|smallfont|};
foreach my $story (@{$S->cache->{CACHE}->{section_stories}->{$section}}) {
my $comments = $S->_commentcount($story->{sid});
$content .= qq{
|dot| <A HREF="|rootdir|/story/$story->{sid}">$story->{title}</A><br>($comments comments)<BR>}; #|
}
$content .= qq{
<A HREf="|rootdir|/section/$section">|dot| more >></A>
|smallfont_end|
<P>};
}
}
# Diary list
my ($rv, $sth) = $S->db_select({
WHAT => 'sid, aid, title',
FROM => 'stories',
WHERE => qq{section = "Diary" AND displaystatus = 1},
ORDER_BY => 'time DESC',
LIMIT => 15});
$content .= qq{
<B><A HREf="|rootdir|/section/Diary" style="text-decoration:none;"><font color="#000000">New $S->{SECTION_DATA}->{Diary}->{title}</font></A>:</B>
<br>|smallfont|};
while (my $story = $sth->fetchrow_hashref()) {
my $lu = $S->urlify($story->{aid});
#my $comm = $S->_commentcount($story->{sid});
#$comm = '0' unless $comm;
$story->{title} =~ s/(\S{20})/$1 /g;
$content .= qq{
|dot| <A HREF="|rootdir|/user/$lu/diary">$story->{aid}</A>:<br><a href="|rootdir|/story/$story->{sid}" style="text-decoration:none;"><font color="#222222">$story->{title}</font></a><br>}; #($comm comments)<br>};
}
$content .= qq{
<BR>|dot| <A HREf="|rootdir|/?op=search;type=diary;offset=25">More Diaries >></A>
|smallfont_end|
<P>};
return {content => $content};
|