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: Site Stats 1.00

Author: theantix [Info]

Description:

This box is designed to give a rundown of basic statistics for a scoop site. It returns the total number of stories, comments, comment ratings, and users for a site. By default it requires the perm "story_admin", but it is trivial to change.

Box Code:

return 'No Access' unless $S->have_perm('story_admin');

my $return='|smallfont|<table border=0>';

my ($rv,$sth) = $S->db_select({
WHAT => 'count(*) as c',
FROM => 'stories'});

if ( $rv ) {
while (my $r = $sth->fetchrow_hashref) {
$return .= qq{<tr><td>Stories:</td><td> $r->{c}</td></tr>};
};
}

#comments
my ($rv,$sth) = $S->db_select({
WHAT => 'count(*) as c',
FROM => 'comments'});

if ( $rv ) {
while (my $r = $sth->fetchrow_hashref) {
$return .= qq{<tr><td>Comments:</td><td> $r->{c}</td></tr>};
};
}


#comment ratings
my ($rv,$sth) = $S->db_select({
WHAT => 'count(*) as c',
FROM => 'commentratings'});

if ( $rv ) {
while (my $r = $sth->fetchrow_hashref) {
$return .= qq{<tr><td>Ratings:</td><td> $r->{c}</td></tr>};
};
}

#users
my ($rv,$sth) = $S->db_select({
WHAT => 'count(*) as c',
FROM => 'users'});

if ( $rv ) {
while (my $r = $sth->fetchrow_hashref) {
$return .= qq{<tr><td>Users:</td><td> $r->{c}</td></tr>};
};
}

$sth->finish();

$return .= '</table>|smallfont_end|';

return $return;
Display: Sort:
Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Satanosphere
/* You are not expected to understand this. */

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