Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Dropdown Menu Category Options

Quote Reply
Dropdown Menu Category Options
Hey everyone --


Code:
sub {
my ($category,$output);
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', 'CatDepth', 'Number_of_Links'] ) || return $GT::SQL::error;
$output .= qq|<select name="nnn-DeptSelect" onchange="top.location=this.options[this.selectedIndex].value" size="1" style="color:white; background-color:rgb(158,140,116);">\n|;
$output .= qq|<option selected>Website Categories</option>\n|;

while (my ($id,$full_name, $depth, $cnt) = $sth->fetchrow_array) {
my $safe_full = $full_name;
my @cut = split /\//, $full_name;

my $back = '';
for (my $i=0; $i < $#cut; $i++) {
$back .= q|&nbsp;&nbsp;|;
}
$back .= $cut[$#cut];
$output .= qq|<option value="$CFG->{build_root_url}/| . $db->as_url($safe_full) . qq|/$CFG->{build_index}">$back ($cnt)</option>|. "\n";
}
$output .= "</select>\n";
return \$output;
}


Can someone help me change this twice?

I would like to have one drop down menu with only the top-level categories.

And another one with the subcategories but only those categories that have actual links in them, if possible with an <%if%> statement.

Any help on this would be greatly appreciated.

SandraR


Sandra Roussel
Chonsa Group Design - Fresh Start Housing
Subject Author Views Date
Post Dropdown Menu Category Options SandraR 1584 Jun 12, 2007, 8:13 PM