Gossamer Forum
Home : Products : DBMan : Customization :

Categpry MOD retry

Quote Reply
Categpry MOD retry
Hi there,

I have try before to get help for this problem but nobody answer. So i try again other way.
I want to use the (list category and gie a count) mod inside the html.pl file as a sub (html_categorie_view) so i can call this by SSI

However in this mod the category field is define by a variable in the source. Is it possible to change the MOD so that i can call the field by parameters like db.cgi?db=db&html_category_view=10

is this possible and if so how can i make this.

Thanks for the help
Marcel

sub html_categorie_view {

$cat_name = "merk";

&html_print_headers;

for ($i = 0; $i <= $#db_cols; $i++) {
if ($db_cols[$i] eq "$cat_name") {
$fieldnum = $i; $found = 1;
last;
}
}
if (!$found) {
&cgierr("No $cat_name field defined");
}
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 ($field[10] =~ /sale/) { # Change the 2 to match the field number you want to search
@values = split (/\Q$db_delim\E/o, $fields[$fieldnum]);
foreach $value (@values) {
if (!(grep $_ eq $value, @selectfields)) {
push (@selectfields, $value);
}
++$count{$value};
}
}
}
close DB;

foreach $field (sort @selectfields) {
$sfield = &urlencode($field);
print qq|<FONT SIZE="-1" FACE="Verdana,Tahoma,Arial,Helvetica,sans-serif"><a href="$db_script_link_url&$&view_records=1&ID=*&$cat_name=$sfield&cat_nl=sale&sb=1&so=descend">$field</font></a><br>|;
}
}
Quote Reply
Re: [Marcel Emmen] Categpry MOD retry In reply to
Quote:
db.cgi?db=db&html_category_view=10

I do not think the =10 is the answer.

I think this is always =1.

The =1 tells the script to run the sub called html_category_view.

If you build a sub that counts and makes links for column 10, then the =1 should work. If you want a single sub that will count and make links for any column, I am not sure.

Good luck!