Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

linksql cannot run keyword banner search , but links 2.0 can run it !!

Quote Reply
linksql cannot run keyword banner search , but links 2.0 can run it !!
 
Now i have 1 problem with keyword banner search program,

at Links 2.0 , I can run keyword banner search ,

but at linksql i can not run it .


At links 2.0 , I can run it i change the script as below :--

File: site_html.pl
************************************************************************************

sub site_html_search_results {
# --------------------------------------------------------
# This routine displays the search results.
#
my $term = &urlencode ($in{'query'});
&html_print_headers;
print &load_template ('search_results.html', {
term => $term,
link_results => $link_results,
category_results => $category_results,
next => $next,
cat_hits => $cat_hits,
link_hits => $link_hits,
%in,
%globals
});
}

************************************************************************************
************************************************************************************
change To
************************************************************************************
************************************************************************************
sub site_html_search_results {
# --------------------------------------------------------
# This routine displays the search results.
#
my $term = &urlencode ($in{'query'});
&html_print_headers;

@keyword1 = ('email','www','web');

@keyword2 = ('pc','game','sofeware');

$sr = "search_results.html";


foreach $keywords1 (@keyword1) {
if ( $term =~ /$keywords1/i) {
$sr = "search_results1.html";

}
}

foreach $keywords2 (@keyword2) {
if ( $term =~ /$keywords2/i) {
$sr = "search_results2.html";

}
}


print &load_template ($sr, {
term => $term,
link_results => $link_results,
category_results => $category_results,
next => $next,
cat_hits => $cat_hits,
link_hits => $link_hits,
%in,
%globals
});
}

************************************************************************************

So at links 2.0

search keyword is "email" , then run search_results1.html templates,
search keyword is "pc" , then run search_results2.html templates,


####################################################################################
####################################################################################


But Now at search linksSQL , I cannot run it,



At linksql i changer from
File: HTML_Templates.pl
************************************************************************************
sub site_html_search_results {
# --------------------------------------------------------
# This routine displays the search results.
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('search_results.html', {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}
*****************************************************************************************
************************************************************************************
change to
************************************************************************************
****************************************************************************************

sub site_html_search_results {
# --------------------------------------------------------
# This routine displays the search results.
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);

@keyword1 = ('email','www','web');

@keyword2 = ('pc','game','sofeware');

$sr = "search_results.html";


foreach $keywords1 (@keyword1) {
if ( $tags =~ /$keywords1/i) {
$sr = "search_results_bc.html";

}
}

foreach $keywords2 (@keyword2) {
if ( $tags =~ /$keywords2/i) {
$sr = "search_results_bc.html";

}
}


my $output = &load_template ($sr, {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}
****************************************************************************************

But i can not run it ,

I think the error is at

****************************************************
if ( $tags =~ /$keywords1/i) {
****************************************************

the $tags must change to ????



Do u have any idea , Please help me .
Thanks.
Quote Reply
Re: linksql cannot run keyword banner search , but links 2.0 can run it !! In reply to
Ok.... I'm not sure what you are trying to do, but you've kinda screwed up "$tags" which is a pointer to a hash of the tags available in the template.

What you want to do is use the
$in->param('query')
value to pick out your banners.

Check how the search.cgi takes the term, and passes it along.

You can then pass that term explicitly to the search routines --- the most portable way would be to insert it into the passed hash ---

It would then be available for use in any of the routines that you'd want to use it.

Again, I've lost the thread of what you are trying to do, but hopefully this will help.

Quote Reply
Re: linksql cannot run keyword banner search , but links 2.0 can run it !! In reply to
thanks
Quote Reply
Re: [haharara2000] linksql cannot run keyword banner search , but links 2.0 can run it !! In reply to
Hello,

Someone has a Global or Plugin to do this? That is: To setup banners that shown by keywords as Links 2 do.

Thanks! :)