Gossamer Forum
Home : Products : DBMan : Customization :

how to browse through search results

Quote Reply
how to browse through search results
Hi,

say, I have a database i use for images.
Well, as a matter of fact, I am using dbman for exactly that:

www.peng.nl/photo/

Now, if i´ve clicked on a category or searched for a keyword, I get the results as thumbnails (html_record).

When I click on them, I go to html_record_long and it all works fine. However, once I´m there, in stead of having to go back to go to the search results, I´d like to have a "next" link to the next search result, straight away in html_record_long. So somehow, that link needs to know which one was the following search result.

Has this been done yet? I didn´t find info in the FAQ.

Thanks,

Lex
Quote Reply
Re: [Lex] how to browse through search results In reply to
It's already part of html_record_long.

Code:
if ($next_hit <= $db_total_hits) {
$next = qq~<a href="$db_script_url?$next_url&nh=$next_hit"><$font>Next</font></a>~;}
else {
$next = " ";
}


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.

Last edited by:

JPDeni: Jul 30, 2005, 12:10 PM
Quote Reply
Re: [JPDeni] how to browse through search results In reply to
:)

Jesus! In all my modifying dbman, I must have thrown this out rigth in the beginning somewhere!

Thanks a lot JPDeni!

Sometimes solutions are too simple to see them.
Quote Reply
Re: [Lex] how to browse through search results In reply to
hmm... Both $next_url and $next_hit remain empty if I use it in html_record_long.

Where are they set? (If you know what I mean). Could someone copy the code?

I've found $next_url in db.cgi, but it´s used for the result of search pages, to produce the next, say, 10 results.
Quote Reply
Re: [Lex] how to browse through search results In reply to
Okay, I´ve found it here on the forum.

(if any one needs it, here it is:)

# create links to previous and next records

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

if ($prev_hit) {
$previous = qq~<a href="$db_script_url?$next_url&nh=$prev_hit"><$font>Previous</font></a>~;
}
else { $previous = " "; }

if ($next_hit <= $db_total_hits) {
$next = qq~<a href="$db_script_url?$next_url&nh=$next_hit"><$font>Next</font></a>~;
}
else { $next = " "; }

# create link back to short display
$list_url = $next_url;
$list_url =~ s/\&mh=\d+//;
$mh = $db_max_hits;
$lh = int(($nh-1)/$mh) + 1;
$list = qq~<a href="$db_script_url?$list_url&nh=$lh"><$font>Back to record list</font></a>~;

}
Quote Reply
Re: [Lex] how to browse through search results In reply to
It's also in the mod --

http://www.jpdeni.com/...ods/short_change.txt



To complete the code, the variables need to be printed out:
Code:
# print out the links
print qq|
<table width=100%>
<tr><td width=50%>$previous</td>
<td width=50% align=right>$next</td></tr>
<tr><td colspan=2 align=center>$list</td></tr>
<tr><td colspan=2 align=center><$font>Record $nh of $db_total_hits</font></table>
|;


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.