Gossamer Forum
Home : Products : DBMan : Customization :

Where to install "List Categories"

Quote Reply
Where to install "List Categories"
I'm trying to install the "List Categories" mod, but I keep getting "DBMan Error" messages. I've added the needed subroutine to db.cgi, and I've modified the lines in the mod as listed in the comments.

I'm trying to add it to he html_record_ssi page, but I'm not sure where to put it. Here is the original code:

Code:
sub html_record_ssi {
#---------------------------------------------------
open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name.\nReason: $!");
@lines = <DB>;
close DB;
$in{'mh'} = $#lines;

my (%rec) = @_;
my $font = 'font size=2';
my $font_tiny = 'font size=1';
print qq|
<$font><a href="$db_script_link_url&view_records=1&Artist=$rec{'Artist'}" target="_top">$rec{'Artist'}</a></font><br>
|;
}

How do I add this code in there?

Code:
for ($i = 0; $i <= $#db_cols; $i++) {
#### In the line below, replace 'Category' with the name of your field.
if ($db_cols[$i] eq "Artist" ) {
$fieldnum = $i; $found = 1;
last;
}
}
if ($found) {
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);
#### if you are using the validate records mod, uncomment the following line and replace the "4" with the
#### number of your Validated field
# if ($field[4] eq "Yes") {
++$count{$fields[$i]};
if (!(grep $_ eq $fields[$fieldnum], @selectfields)) {
push (@selectfields, $fields[$fieldnum]);
}
#### if you are using the validate records mod, uncomment the following line
# }
}
close DB;

foreach $option (sort @options) {
unless ($count{$option}) {
$count{$option} = '0';
}
$encoded = &urlencode($option);
#### if you only want to list categories that have matching entries, uncomment the following line
# if ($count{$option} ne '0') {
#### In the line below, replace 'Category' with the name of your field.
print qq|
<a href="$db_script_link_url&Artist=$encoded&view_records=1">$option</a> ($count{$option})<BR>
|;
#### if you only want to list categories that have matching entries, uncomment the following line
# }
}
}
Subject Author Views Date
Thread Where to install "List Categories" shalom777 4703 Mar 10, 2004, 6:33 AM
Thread Re: [shalom777] Where to install "List Categories"
Watts 4604 Mar 10, 2004, 11:14 AM
Thread Re: [Watts] Where to install "List Categories"
LoisC 4594 Mar 10, 2004, 3:56 PM
Thread Re: [LoisC] Where to install "List Categories"
shalom777 4582 Mar 13, 2004, 2:16 PM
Thread Re: [shalom777] Where to install "List Categories"
LoisC 4589 Mar 14, 2004, 11:33 AM
Thread Re: [LoisC] Where to install "List Categories"
shalom777 4578 Mar 14, 2004, 3:06 PM
Thread Re: [shalom777] Where to install "List Categories"
LoisC 4575 Mar 16, 2004, 1:11 AM
Post Re: [LoisC] Where to install "List Categories"
shalom777 4535 Apr 1, 2004, 8:33 PM