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: section_headlines 1.00

Author: hurstdog [Info]

Description:

given a section name, ( like |BOX,section_headlines,news| it will show the latest headlines from them.

Box Code:

my $content;

# Call with one argument: section id
my $section = shift @ARGS;
my $count = shift @ARGS \|\| 6;
return unless ($section && $count);

# Get $count new stories from $section
my ($rv, $sth) = $S->db_select({
WHAT => 'sid, title, aid, tid, displaystatus',
FROM => 'stories',
WHERE => qq{section = '$section' AND displaystatus >= 0},
ORDER_BY => 'time DESC',
LIMIT => qq{$count}});

my $stories = $sth->fetchall_arrayref();
$sth->finish();

my $show = $S->{UI}->{VARS}->{show_new_comments};

foreach my $story (@{$stories}) {
my $num_new = $S->new_comments_since_last_seen($story->[0]) if ($show eq "hotlist" \|\| $show eq "all");
my $count = $S->_commentcount($story->[0]);
my $end_s = ($count == 1) ? '' : 's';

my $new_disp = ($num_new) ? "<b>$num_new</b>" : 0;
my $urlnick = $S->urlify($story->[2]);
$story->[2] =~ s/(\S{20})/$1- /g;
$story->[1] =~ s/(\S{20})/$1 /g;
my $b_start = ($story->[4]) ? '' : '<b>';
my $b_end = ($story->[4]) ? '' : '</b>';
my $topic = ($section eq 'Diary') ? qq{$story->[2]'s Diary} : $S->{TOPIC_DATA}->{$story->[3]}->{alttext};#'
my $topic_path = ($section eq 'Diary') ? "/user/$urlnick/diary" : qq{/search/?topic=$story->[3]};


$content .= qq{
$b_start<a href="|rootdir|/story/$story->[0]">$story->[1]</a>$b_end<br>
$count comment$end_s, $new_disp new<br>
<font size="-2">by <a href="|rootdir|/user/$urlnick">$story->[2]</a>, <a href="|rootdir|$topic_path">$topic</a></font><p>};
}

my $s_type = ($section eq 'Diary') ? 'diary' : 'story';

$content .= qq{
<a href="|rootdir|/search/?offset=0;old_count=$count;type=$s_type;section=$section;count=30;next=1">More $S->{SECTION_DATA}->{$section}->{title}...</a>
};

# Set title
my $title = qq{<a href="|rootdir|/section/$section"><font color="#FFFFFF">$S->{SECTION_DATA}->{$section}->{title}</font></a>};
return {title => $title, content => $content};
Display: Sort:
Great content (none / 0) (#1)
by normanarron on Fri Oct 26, 2018 at 03:00:01 AM PST

Simply respecting your work and thinking about how you dealt with this blog so well. It's remarkable to the point that I can't stand to not experience this significant data at whatever point I surf the web Hire Essay Writer!



hi (none / 0) (#3)
by Nisha Knapp on Sat Sep 11, 2021 at 03:14:14 PM PST

Thanks, heaps again for the tips, I always come to your website looking for updates and new posts. We as working in Search engine optimization it helps us a lot that you're giving us so many opportunities in our line. And it gave us knowledge and points at the same time. I hope you lead in the right path. Thanks Again 먹튀검증



Menu
create account
faq
search
report bugs
Scoop Administrators Guide
Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Scoop::Ads
Almost there...

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