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: Domain-Only Referer View 1.00

Author: envygreen [Info]

Description:

An update of janra's useful referer_view box. Just a minor Perl hack, this one snips the referring URL down to just the domain name part of the referer. It still links to the full referring URL, but can help clean up your referrer box when you're getting those 80 character long URL's. I also took out the UL and LI tags, preferring to put just my |dot| macro in at box entry time. But that's up to you. :)

Box Code:

## START referer_view ##
# This box displays the referer information
# collected by referer_catch. It requires a
# table called 'referer' in your database;
# please see the comments in referer_catch.

my $title = "External links in";
my $content = "";

my ($rv, $sth) = $S->db_select({
WHAT => '*',
FROM => 'referer',
ORDER_BY => 'hits DESC'
});

while ( my $referers = $sth->fetchrow_hashref ) {;

# now to format and print them
#foreach my $ref ( %$referers ) {
# my $url = $ref->{url};
# my $hits = $ref->{hits};
my $url = $referers->{url};
my $hits = $referers->{hits};
my $chopped_url = substr( $url, 7);
my $end_of_url = index ($chopped_url, "/" );
$chopped_url = substr ($chopped_url,0, $end_of_url);


if ( $url =~ /^-$/ ) {
$content .= qq{no referer ($hits)<br>};
} else {
$content .= qq{<A href="$url">$chopped_url</A> ($hits hits)<br>};
}
}

$content .= "<br>";
return $title, $content;

## END referer_view ##

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

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

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