Gossamer Forum
Home : Products : Links 2.0 : Customization :

altavista.cgi

Quote Reply
altavista.cgi
If anyone has fixed the bug in the altavista.cgi next hits toolbar please let us know how to do it.

Thanks

Eduardo
Quote Reply
Re: altavista.cgi In reply to
replace the sub next_hits with the following:

sub next_hits {
# ----------------------------------------------
# Creates a next hits toolbar.
#
my ($page, $numhits, $maxhits) = @_;
my ($left, $right, $upper, $lower, $next_hit, $prev_hit, $i, $page_no);
my $nh = int ($page / $maxhits) | | 0;
my $output = '';
$numhits =~ s/,//g;
$numhits = int ($numhits);

my $next_url = $ENV{'QUERY_STRING'};
$next_url =~ s/\&nh=\d+//;
$next_hit = $nh + 1; $prev_hit = $nh - 1;

# First, set how many pages we have on the left and the right.
$left = $nh; $right = int($numhits/$maxhits) - $nh;
# Then work out what page number we can go above and below.
($left > 7) ? ($lower = $left - 7) : ($lower = 0);
($right > 7) ? ($upper = $nh + 7) : ($upper = int($numhits/$maxhits) + 1);
# Finally, adjust those page numbers if we are near an endpoint.
(7 - $nh >= 0) and ($upper = $upper + (8 - $nh));
($nh > ($numhits/$maxhits - 7)) and ($lower = $lower - ($nh - int($numhits/$maxhits - 7) - 1));

# Then let's go through the pages and build the HTML.
($nh > 0) and ($output .= qq~<a href="$ENV{'SCRIPT_NAME'}?$next_url&nh=$prev_hit">[<< Prev]</a> ~);
for ($i = 0; $i <= int($numhits/$maxhits) + 1; $i++) {
last if ($i > 19);
if ($i < $lower) { $output .= " ... "; $i = ($lower-1); next; }
if ($i > $upper) { $output .= " ... "; last; }
$page_no = $i + 1;
($i == $nh) ?
($output .= qq~$page_no ~) :
($output .= qq~<a href="$ENV{'SCRIPT_NAME'}?$next_url&nh=$i">$page_no</a> ~);
(($page_no * $maxhits) >= $numhits) and last; # Special case if we hit exact.
}
$output .= qq~<a href="$ENV{'SCRIPT_NAME'}?$next_url&nh=$next_hit">[Next >>]</a> ~ unless (($nh == $i) or ($nh == 19));
return $output;
}
Quote Reply
Re: altavista.cgi In reply to
Only replace add the line page_q and replace my $url with the my $url below:

----
my $page = ($in->param('nh') * 10) &#0124; &#0124; 0;
my $page_q = (($in->param('nh') - 1) * 10) &#0124; &#0124; 0;
my $url = "http://www.altavista.com/cgi-bin/query?q=$query_q&text=yes&kl=nl&stq=$page_q";
Quote Reply
Re: altavista.cgi In reply to
Thank you guys!

I have fixed it up
Quote Reply
Re: altavista.cgi In reply to
Olá Eduardo,

Você poderia me enviar a sua versão modificada do altavista.cgi??

Eu tentei fazer as modificações mas eu recebo um erro 500 ao acessar o script.

Se possivél envie para este e-mail : lsaud@manaus.br

Obrigado

------------------
[]'s

Lucas Saud - #19815087





Quote Reply
Re: altavista.cgi In reply to
Hi Lucas,

The only changes that i made to the script was the one shown here in order to fix the bug with the next hits toolbar. Nothing more. If you still want me to send you the script anyway, just let me know


Eduardo

P.S.

If you get a 500 server error, try the following:
- Make sure you uploaded in ASCII mode (NOT binary). Re-upload.
- Make sure the path to Perl is correct.
- Make sure you set the script to CHMOD 755 or 777.
- Make sure you can run CGI scripts in the directory the script is in.


[This message has been edited by volpi (edited January 25, 1999).]

[This message has been edited by volpi (edited January 25, 1999).]
Quote Reply
Re: altavista.cgi In reply to
Eduardo eu recebo um erro interno ao executar o altavista.cgi

Mas quando eu executo o excite.pl o script funciona normalmente....Me envie o seu altavista.cgi...por favor

------------------
[]'s

Lucas Saud - #19815087






Quote Reply
Re: altavista.cgi In reply to
What is altavista.cgi?
Quote Reply
Re: altavista.cgi In reply to
What is altavista.cgi?<P>------------------<BR>rgrdz,
TukBa

Quote Reply
Re: altavista.cgi In reply to
Hi TukBa,

Altavista.cgi is a script written to get a search results from alatavista data base and put in your script.

Is very good and fast.


Look: http://www.gossamer-threads.com/scripts/misc/altavista.cgi

------------------
[]'s

Lucas Saud - #19815087






Quote Reply
Re: altavista.cgi In reply to
uh, 10x! ;-)

This script is great!

I'm not Perl expert, so can anyone make changes in the script so he can hanlde let's say.. Excite?

------------------
rgrdz,
TukBa
ICQ: 1005139
Quote Reply
Re: altavista.cgi In reply to
hi.. i want to know if it's possible to make it.. "excite".. instead of altavista..

i tried once.. but i kept getting problems.. i got it to work in the sense that i only could get the url and title.. but no descriptiong.. that is most like because they use multiple lines.. any ideas?

thanks