Gossamer Forum
Quote Reply
Category Drop Down Field
Hi champs,

I have the folowing global, which I assume originated from andy or laura. I want to add the possiblity to pass a parameter of the top category, so that I can call the global like <%global('1')%>, whereas 1 stands for the top category that will be included in the selection of the categories. For example, if I have

catid 1 = ABC
catid 2 = CDE

if I use the global <%global('1')%>, only the caid 1 and all the subcategories should be shown in the drop down field.

sub {
my $show_count = $_[0];
my $category;
my $db = $DB->table('Category') || return $GT::SQL::error;
$db->select_options('ORDER BY Full_Name') || return $GT::SQL::error;
my $sth = $db->select( ['ID','Full_Name','Number_of_Links'] ) || return $GT::SQL::error;

my $back;

while (my ($id,$full_name,$numberoflinks) = $sth->fetchrow_array) {

my $full_name2;
my @cut = split /\//, $full_name;
for (my $i=0; $i < $#cut; $i++) {

$full_name2 .= "&nbsp;&nbsp;";

}

$full_name2 .= $cut[$#cut];
if ($show_count) {
$full_name2 .= " ($numberoflinks)";
}

$back .= "<option value=\"$id\">$full_name2</option>";

}

my $send_back = qq|<select size="1" name="catid"><option value=""<------</option>$back</select>|;

return $send_back;

}



Cheers.
Subject Author Views Date
Thread Category Drop Down Field vacationrentals 2852 Sep 28, 2004, 3:44 AM
Thread Re: [vacationrentals] Category Drop Down Field
Andy 2754 Sep 28, 2004, 7:48 AM
Post Re: [Andy] Category Drop Down Field
vacationrentals 2762 Sep 28, 2004, 8:31 AM