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

Top Cagegory Global Question

Quote Reply
Top Cagegory Global Question
HI!
I am using the Top Category Global, and I want to include the category description in addition to the name, but I have not been able to figure out how to do it.... can any one help?

sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options("ORDER BY Full_Name");
my @root_cats = $cat_db->select ('Full_Name', { FatherID => 0 })->fetchall_list();
my $output;
foreach my $root_cat (@root_cats) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<div class="rbsDept"><a href="$CFG->{build_root_url}/$url" style="text-decoration: none">$root_cat</a></div><div class="rbsSub"> </div>~;
}
return $output;
}

Thanks,
George
Quote Reply
Re: [macbethgr] Top Cagegory Global Question In reply to
sub {
my $tags = shift;
my $cat_db = $DB->table('Category');
$cat_db->select_options("ORDER BY Full_Name");
my $sth = $cat_db->select (['Full_Name','Description'], { FatherID => 0 });
my $output;
while (my ($root_cat,$desc)=$sth->fetchrow_array) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<div class="rbsDept"><a href="$CFG->{build_root_url}/$url" style="text-decoration: none">$root_cat</a></div><div class="rbsSub"> </div>~;
}
return $output;
}
Quote Reply
Re: [afinlr] Top Cagegory Global Question In reply to
Thanks for your reply...

I tried the code and it did not bring back the category description.
Also, I should have included: I wanted to format the description differently than the category name.

Thanks
George
Quote Reply
Re: [macbethgr] Top Cagegory Global Question In reply to
Hi George,

I didn't actually put the description into the output as I wasn't sure how you would want it. It is available as a variable - just put $desc where you want the description somewhere in the output variable.

Laura.
Quote Reply
Re: [afinlr] Top Cagegory Global Question In reply to
Thanks! That did it!