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: showtopics_box 1.01

Author: ip4noman [Info]

Description:

This box, when included in a /special page, renders a dynamic list of topics, with their images and links to the search page. Number of columns is variable (default 5)

Box Code:

# showtopics_box by Bill Huston, bhuston@vegdot.org
# v1.1 27 Feb 2003 added case insensitive sort

my $cols = shift @ARGS \|\| 5;

my ($rv, $sth) = $S->db_select({
WHAT => 'tid,image,alttext,width,height',
FROM => 'topics',
});

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

my $content = "<table border=0>";

my $images = $S->{UI}->{VARS}->{imagedir}.$S->{UI}->{VARS}->{topics};

my $col=0;

foreach my $topic (sort {lc($a->[0]) cmp lc($b->[0])} ( @{$topics})) {

my ($tid,$image,$alttext,$width,$height)= @$topic;

next if $tid =~ /^(all\|diary)$/;

if ($col) { $content .= "<td align=\"center\">"; } else {
$content .= "<tr><td align=\"center\">";}

$content .= "$topic->[0]";

$content .= qq{

<img src="$images/$image" alt="$alttext" width=$width height=$height><br><a href="/search/topic=$tid">$alttext</a>

};

$col = ($col+1) % $cols;

if ($col) {
$content .= "</td>"
} else {
$content .= "</td></tr>"
}


};

$content .= "</table>";

return{title=>"All Topics",content=>$content};
Display: Sort:
Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Keepers of Lists
Got Lists? We've got over 1800

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