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

Author: hurstdog [Info]


This displays the number of users that have viewed a particular story.

Box Code:

# story_hit_box
# NOTE: you might want to add an index to your
# viewed_stories table to make this run quite
# a bit faster, especially if your site is more
# than just a little busy
# mysql> create index sid_idx on viewed_stories (sid);
# ALSO, this doesn't cache yet, it will in the future.
# Shouldn't be a problem for small sites.
my $sid = $S->{CGI}->param('sid');

$sid = $S->{DBH}->quote($sid);

my ($rv,$sth) = $S->db_select({
FROM => 'viewed_stories',
WHAT => 'count(uid) as c',
WHERE => "sid = $sid"

my $count = 0;
if( $rv ) {
my $r = $sth->fetchrow_hashref;
$count = $r->{c};

my $content = qq[
  %%norm_font%%<b>$count</b> Scoop users have viewed this story.%%norm_font_end%%

return { content => $content };
Display: Sort:
great (none / 0) (#1)
by cofakabel on Mon Apr 01, 2019 at 06:47:55 AM PST

This code lets the people know how to implement the moral things in the real life.There are many places to visit in and around Goa. First of all you should make plan about which places you want to visit. Beach, heritage and temple all make the Goa more interesting and wonderful to the visitors. I found many things to share about Goa and would like to share this so that the interested group of people may have accurate information to get the best one.

create account
report bugs
Scoop Administrators Guide
Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
The swiss army chainsaw of Content Managment.

Make a new account

Hosted by 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