Gossamer Forum
Home : Products : DBMan : Customization :

Override maxhits for a what's new list

Quote Reply
Override maxhits for a what's new list
Hi,
I'm using a what's new list on the front page. It only shows a maximum of 10 items, probably because $maxhits = 10.

What I have now is this:
Code:

$days = 8; # set this one day more than you want records to be considered "new."
# If you want to include records from the previous 7 days, set the number
# to 8.
$in{'Lastmodified-gt'} = &get_date_and_time(time() - ($days * 86400));
my ($status, @hits) = &query("view");
my ($maxhits) = 999;
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = 999);
if ($status eq "ok") {
my ($numhits) = ($#hits+1) / ($#db_cols+1);

print "<div align=left><ul>";
for (0 .. $numhits - 1) {
%rec = &array_to_hash($_, @hits);
$tit = '';
$tit = substr($rec{'Title'},0,50);
$whats_new .= "<li>Opdr. $rec{$db_key}: <a href=\"$db_script_link_url&view_records=1&ww=1&$db_key=$rec{$db_key}\">$tit</a><br>";
++$i;
}
print $whats_new;
print "</ul></div>";
}


Somehow I still only get 10 records, even though there are more records in the database modified in the last 7 days.

I'm running out of clues. Anyone has a suggestion?

cheers and thanks, peter
Quote Reply
Re: [peter01] Override maxhits for a what's new list In reply to
Set your $in{'mh'} before you do the &query.

Code:
$in{'Lastmodified-gt'} = &get_date_and_time(time() - ($days * 86400));
$in{'mh'} = 999;
my ($status, @hits) = &query("view");
if ($status eq "ok") {

and so on.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Override maxhits for a what's new list In reply to
Works, thanks very much!

cheers, peter