Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Display SearchLog Results

Quote Reply
Display SearchLog Results
Greetings:

Is there a way (I am sure there would be) to display the top 5 or 10 key search words that people are searching for on a site (as displayed in the Search Log in GLinks 3)?


Regards,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] Display SearchLog Results In reply to
Hi,

Give this a go =) (untested)

Code:
sub {

my $tbl = $DB->table('SearchLogs');
$tbl->select_options('ORDER BY slog_time DESC','LIMIT 5');
my $sth = $tbl->select() || return $GT::SQL::error

my @back;
while (my $hit = $sth->fetchrow_hashref) {
my $hit2;
map { s/slog\_//; $hit2->{$_} = $hit->{$_} } keys %$hit;
$hit2->{url} = $CFG->{db_cgi_url} . "/search.cgi?query=" . $hit->{slog_query};
push @back, $hit;
}

return { recent_search => \@back };

# query
# count
# hits
# time
# last

}

Call it with;

<%global_name%>

..and then;

Code:
<%loop recent_search%>
<a href="<%url%>"><%query%></a> - Results: <%count%>
<%endloop%>

Should work Cool

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!