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

Max Cat Hits

Quote Reply
Max Cat Hits
Hello pugdog,
We are trying to break up our category results into several pages with 20 categories per page. According to the forum we added the following code in our "search.cgi" script:
if ($counter <=20)
{
$rec->{more}=0;
}
else
{
$rec->{more}=1;
}

to this section of the code:
# Only display the category output on the first page.
my $counter=0;
if ($nh == 1) {
if ($cat_hits) {
foreach my $hit (@$cat_hits) {
$counter++;
$hit = $catdb->array_to_hash($hit);
$category_results .= "<li>" . &search_build_linked_title ($hit->{Name}) . "\n";
if ($counter >= 20) {last}

Also, to the search_results.html template we added:
<%if more%>
<a href=.....>[more]</A>
<%endif%>

We ended up with this message:
Software error:
Execution of /usr/local/etc/httpd/cgi-bin/admin2/search_temp.cgi aborted due to compilation errors.

We would like to have our search results displayed similar to that of Yahoo's.

Quote Reply
Re: Max Cat Hits In reply to
Without looking at the logic, assuming you got it right, take a look at the error log. The two most common reasons for that error are:

1) missing punctuation == ; } or )

2) failure to declare a variable with my before using it

That should point you at the right place.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Max Cat Hits In reply to
Hi Ahmed

I am missing 3 closing "}" in your code 2x if 1x foreach.

regards, alexander

Quote Reply
Re: Max Cat Hits In reply to
It probably is closing '}', but I've made so many errors cutting/pasting that he needs to check his error log first, since I don't want to tell him to add extra } and they are there, but got cut out of his paste.

Your error log is really the first place to look, and trying to debug a program without it is an effort in futility.

:)


http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Max Cat Hits In reply to
Hi,

shure it is. But I personally hate errorlog entrys about missing "}" because the rest of the code is interpreted wrong and pearl complains about syntax errors some lines afterwards.

regards, alexander


Quote Reply
Re: Max Cat Hits In reply to
Yes, but start with the first reported error, and the problem is usually within a line or two of that.

Then, re-run it, and look at the error log. If all the errors go away, that was all it was. If there are more errors, you again start with the first, and work down. :)


http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/