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

Main Category / Sub Category Global

Quote Reply
Main Category / Sub Category Global
I've got a global that I'm happy with but I want to remove all the subcategories so that it just shows the main categories...

Any ideas? Thanks for any help in advance...

Code:
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','ID','Name','CatDepth','Number_of_Links','Has_New_Links','Has_Changed_Links'] );
my $output=qq~<table width="100%"><tr valign=top><td width="50%"><table>~;
my $i=0;
while (my ($cat,$ID,$heading,$depth,$cnt,$new,$changed) = $sth->fetchrow_array) {
$i++;
my $url1 = $cat_db->as_url($cat);
$output.= qq~<tr><td>~;
my $depth = ($cat =~ tr/\///);
if ($depth > 0){
$output .= "&nbsp;&nbsp;"x$depth."<font size=-1>";
} else { $output.="<b>"; }
$output.=qq~<a href="$CFG->{build_root_url}/$url1" class="toc">$heading</a> ($cnt)~;
if ($new eq "Yes") { $output .= qq| <span class="new-item"><span>new</span></span> |; }
if ($changed eq "Yes") { $output .= qq| <span class="updated-item"><span>updated</span></span> |; }
if ($depth > 0){
$output .= "</font>";
} else {$output.="</b>";}
$output.=qq~</td></tr>~;
if (($i eq '38')){ $output.=qq~</table></td><td width="50%"><table align=top>~;}
}
$output.="</table></td></tr></table>";
return $output;
}
Subject Author Views Date
Thread Main Category / Sub Category Global markhe 4522 Aug 15, 2007, 6:19 PM
Thread Re: [markhe] Main Category / Sub Category Global
VishalT 4422 Aug 15, 2007, 10:32 PM
Post Re: [SWDevil.Com] Main Category / Sub Category Global
Matthias70 4398 Aug 16, 2007, 1:28 AM
Thread Re: [markhe] Main Category / Sub Category Global
Andy 4437 Aug 16, 2007, 1:46 AM
Thread Re: [Andy] Main Category / Sub Category Global
markhe 4393 Aug 16, 2007, 2:36 PM
Thread Re: [markhe] Main Category / Sub Category Global
Andy 4390 Aug 17, 2007, 2:24 AM
Thread Re: [Andy] Main Category / Sub Category Global
markhe 4378 Aug 17, 2007, 2:22 PM
Post Re: [markhe] Main Category / Sub Category Global
Andy 4372 Aug 18, 2007, 1:59 AM