Gossamer Forum
Home : Products : DBMan : Customization :

Question about previous/next records

Quote Reply
Question about previous/next records
Is it possible to get from the previous/next records code the actual $rec{$db_key} of the associated record? I would like to pull a field off both the previous and next records to display on the current record, e.g.

RECORD X
Field N of Record X-1
Field N of Record X+1

If I use $nh, it get the field from the record at the abosulte position in the database, as opposed to the relative position in the search results. Make sense?
Quote Reply
Re: Question about previous/next records In reply to
Hmmm...Welp, you can try is define the following two variables in the sub_html_record_long routine:

Code:
$next = $rec{$db_key} + 1;
$prev = $rec{$db_key} - 1;

Then add the following URLs to your sub html_record_long routine after the print qq| code.

Code:
<$font>
<center>
<a href="$db_script_link_url&ww=on&$db_key=$next&view_records=1">Next Record</a>
<a href="$db_script_link_url&ww=on&$db_key=$prev&view_records=1">Previous Record</a>
</center>
</font>

This has not been tested, but the syntax and codes look right. They should work.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Question about previous/next records In reply to
AWESOME! Works perfectly!! Thanks a ton. Is it possible to make a link to go back to the short listings page that you clicked into from the record while keeping the spot that you were originall in? So lets say you have something like:

<< 1 2 3 >> and you clicked on a detailed_url in "3" and once your done reading that detailed stuff, you want to go back to the page with the << 1 2 3 >> on it on the page "3". Is that possible?

Thanks for your help, its greatly appreciated!!!!

------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: Question about previous/next records In reply to
There would be a little bit more to it. I don't have time to look at or write codes now.

May be later.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Question about previous/next records In reply to
Hmmm... OK, this works to sequentially take you through the DB. I was trying to modify the existing search code (where $db_total_hits >1), which already takes you through the prev/next matching record, as well as back to the short summary.

In particular, one of my DBs is a picture gallery, and on the prev/next link, I wanted to also show a thumbnail of the prev/next picture.

The problem I was having is that the prev/next link is based on a search, and increments/decrements the counter nh with the variables $prev_hit and $next_hit. When using these to link to a field (in my case, <IMG SRC=/img/$prev_hit.jpg> or <IMG SRC=/img/$next_hit.jpg> ), it unfortunately returns the position in the search as opposed to the position in the DB (e.g. $db_key).

For example, if there are 5 records in the DB, and the search returns records 2, 3, and 5, at record 3, $prev_hit refers to record 1 in the search, though I want to pull out somehow $db_key=2, and $next_hit refers to record 3 in the search, though I want to pull out somehow $db_key=5.

Any pointers on how to accomplish this?
Quote Reply
Re: Question about previous/next records In reply to
hi Oldmonkey,

What you are trying to accomplish is exactly how i want to config on my database. Unfornately, I am not good with perl. Please let me know if you figure out how to do that.

Thankx

[This message has been edited by coolandy (edited March 07, 2000).]