Gossamer Forum
Home : Products : DBMan : Customization :

record count in each cat. like link2

Quote Reply
record count in each cat. like link2
      I dont know the way to show the number of record in each category ,something like these;
male (201)
girls (123)
gay (50)
child (12)
Thanks if some1 can help me to do this.
Quote Reply
Re: record count in each cat. like link2 In reply to
Take the codes out of the Number of Records Mod located in the Resource Center, and put them into your html.pl file. Or if you want to use SSI, you can simply use the Number of Records Mod (again located in the Resource Center).

BTW: This particular Mod only works with main categories, NOT sub-categories.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: record count in each cat. like link2 In reply to
I use the following in my html.pl file...
Code:
open (DB, "<$db_file_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
next if /^#/;
next if /^\s*$/;
$line = $_;
chomp ($line);
@fields = &split_decode ($line);
++$catcount{$fields[X]}; # substitute YOUR category field # for X
}
close DB;
@options = split (/\,/, 'Category 1, Category 2, Category 3');
foreach $option (@options) {
$cat_link=&urlencode($option); #removed sort $option
unless ($catcount{$option}) { $catcount{$option} = '0'; }
print qq|<a href="$db_script_url?db=default&uid=$db_uid&Category=$cat_link&sb=2&so=descend&view_records=1">$option</a> ($catcount{$option})<BR>|;
}#}

I typically don't inquire into what my codes are used for and hope that this is not taken the wrong way, but what exactly is this a directory of?

[This message has been edited by oldmoney (edited March 08, 2000).]