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

Modifying Search Log Global

Quote Reply
Modifying Search Log Global
This global gives search terms.

Code:
sub {
# return search table data
my (@links,$sth,$link);
my $search_db = $DB->table('SearchLogs');
$search_db->select_options ("ORDER BY slog_count DESC","LIMIT $_[0]");
$sth = $search_db->select ({});
while (my $link = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags('link', $link);
$link->{slog_query} =~ s/ /+/g;
push@links, $link;
}
return {srchdata=>\@links};
}

Problem --

I'm using the slog_query in the URL and for title. The url is fine with car+mats BUT needing to use slog_query for title WITHOUT the plus, i.e car mats.

How can this be done??

~ ERASER


Free JavaScripts @ Insight Eye
Quote Reply
Re: [Eraser] Modifying Search Log Global In reply to
Code:
sub {
# return search table data
my (@links,$sth,$link);
my $search_db = $DB->table('SearchLogs');
$search_db->select_options ("ORDER BY slog_count DESC","LIMIT $_[0]");
$sth = $search_db->select ({});
while (my $link = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags('link', $link);
$link->{slog_title} = $link->{slog_query};
$link->{slog_query} =~ s/ /+/g;
push@links, $link;
}
return {srchdata=>\@links};
}

...then just use <%slog_title%>
Quote Reply
Re: [Wychwood] Modifying Search Log Global In reply to
Realy great. Many thanks for that.

~ ERASER


Free JavaScripts @ Insight Eye