Here is one solution:
http://www.gossamer-threads.com/...i?post=193600#193600
But as I said at the time, I dont think it is very efficient. I'm using it on my site. Obviously you could change the output so that it gives the output as you specified like this:
sub {
my $tags = shift;
my $cat_id = $tags->{'ID'};
my $name = $tags->{'Name'};
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options ("ORDER BY $CFG->{build_sort_order_category}");
my $sth = $link_db->select ( { CategoryID => $cat_id, isValidated => 'Yes' });
my $output = qq~ <b>$name:</b><br> ~;
while (my $link = $sth->fetchrow_hashref) {
$output .= qq~ <li>$link->{'Title'} ~;
}
my $cat_db = $DB->table('Category');
my $sth2 = $cat_db->select ( ['ID','Name'],{ FatherID => $cat_id });
while (my ($child_id,$subname) = $sth2->fetchrow_array){
$output .= qq~ <br><br><b>$subname:</b><br> ~;
my $sth3 = $link_db->select ( { CategoryID => $child_id, isValidated => 'Yes' });
while (my $link2 = $sth3->fetchrow_hashref) {
$output .= qq~ <li>$link2->{'Title'} ~;
}
}
return $output;
}
What I actually want is all the links in a sortable list rather than by subcategory but I can't see how to do it. I also have lots of links in several categories which appear several times in my dropdown list which is a bit annoying. Anyway, hope it helps you,
Laura.
http://www.gossamer-threads.com/...i?post=193600#193600
But as I said at the time, I dont think it is very efficient. I'm using it on my site. Obviously you could change the output so that it gives the output as you specified like this:
sub {
my $tags = shift;
my $cat_id = $tags->{'ID'};
my $name = $tags->{'Name'};
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options ("ORDER BY $CFG->{build_sort_order_category}");
my $sth = $link_db->select ( { CategoryID => $cat_id, isValidated => 'Yes' });
my $output = qq~ <b>$name:</b><br> ~;
while (my $link = $sth->fetchrow_hashref) {
$output .= qq~ <li>$link->{'Title'} ~;
}
my $cat_db = $DB->table('Category');
my $sth2 = $cat_db->select ( ['ID','Name'],{ FatherID => $cat_id });
while (my ($child_id,$subname) = $sth2->fetchrow_array){
$output .= qq~ <br><br><b>$subname:</b><br> ~;
my $sth3 = $link_db->select ( { CategoryID => $child_id, isValidated => 'Yes' });
while (my $link2 = $sth3->fetchrow_hashref) {
$output .= qq~ <li>$link2->{'Title'} ~;
}
}
return $output;
}
What I actually want is all the links in a sortable list rather than by subcategory but I can't see how to do it. I also have lots of links in several categories which appear several times in my dropdown list which is a bit annoying. Anyway, hope it helps you,
Laura.