Gossamer Forum
Home : Products : DBMan : Customization :

Can' get the link to the last 10 entries to work

Quote Reply
Can' get the link to the last 10 entries to work
I am trying to make a link in the footer to last 10 entries in the database.
I have installed JPDeni's What's New mod. The links I have tried in the footer are:

1) Date field =4
print qq!| <a href="$db_script_link_url&$db_key=*&mh=10&sb=4&so=descend&view_records=1">Vis Siste 10</a> ! if
($per_view);

2) ID field =0
print qq!| <a href="$db_script_link_url&$db_key=*&mh=10&sb=0&so=descend&view_records=1">Vis Siste 10</a> ! if
($per_view);

Both links returned the same as "List All"

The link (New records last 14 days)
print qq!| <a href="$db_script_link_url&listnew=1&view_records=1">Vis Nye siste 14 dager</a> ! if ($per_view);
works fine

Jan Peter
Quote Reply
Re: [JPWiese] Can' get the link to the last 10 entries to work In reply to
Look at the 14 day link and see what is different from the 10 record link. You'll notice that the 14 day link contains a "call" to a subroutine:
a href="$db_script_link_url&listnew=1&view_records=1

Whereas your 10 record link doesn't contain anything that would tell the script to get the "last ten records". The sb=4 just tells the script to "sort by field 4" and I'm not sure if that syntax is correct. It's usually something like sb=fieldname if I'm not mistaken.

I haven't seen the last ten records mod, but I do know that the links you posted are simply the "view all" links so that is why you're getting all of the records.
Quote Reply
Re: [Watts] Can' get the link to the last 10 entries to work In reply to
I see the difference, But can't find out how to solve it. I have searched and tried a lot of things the last hours. It results in either nothing or a 500 error. I can't find the solution.

Jan Peter
Quote Reply
Re: [JPWiese] Can' get the link to the last 10 entries to work In reply to
Check out this link and make sure you got the right mod installed:

http://www.jpdeni.com/dbman/Mods/newrecord.txt

The bit about "&new_records=1" is how you tell the link to pull up the newest records.
Quote Reply
Re: [Watts] Can' get the link to the last 10 entries to work In reply to
I found it and pasted it into my db.cgi and html.pl as stated in newrecord.txt

1) I got a list (short) with 10 records as I asked for, but when I klicked one of them I got two more. When I klicked one of them - nothing happened. It is 12 records in the db.

2) The list does not look like the rest of the db output. There is no formatting of the part between the header and the footer.

You'll find the db at www.nicklisten.no/cgi-bin/dbman/db.cgi Logg in as test/test.

Jan Peter
Quote Reply
Re: [JPWiese] Can' get the link to the last 10 entries to work In reply to
To use your own formatting for the user friendly mod just change the lines:

comment out:
# &html_print_headers;

replace:

<html><head><title>$html_title: New Listings.</title></head>
<body>

with:

&html_page_top;

and do the same for the bottom of the output formatting.

Try changing the code in the newest record sub to include the table tags.

# Go through each hit and convert the array to hash and send to
# html_record for printing.
for (0 .. $numhits - 1) {
print "<P>";
&html_record (&array_to_hash($_, @hits));
}
}
print qq|

change to:

print "<table width=450>";
for (0 .. $numhits - 1) {
print "<tr>";
&html_record (&array_to_hash($_, @hits));
print "</tr>";
}
print "</table>";
}
print qq|

Because viewing the source code of the page isn't currently showing the table cells within table tags for your output.

Hope this helps

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/