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

Directory global (lists all categories)

Quote Reply
Directory global (lists all categories)
Hello,

I am trying to bulid a global that will return a list of categories in alphbetical order. I have taken a global I have found in the forum and modified it, but I am stuck on a few things.
I would like the list to be displayed in 3 columns and would like each new letter to have a header like this:

A
aardvark (2)
alamo (6)
aspen (1)

B
Batter (2)
Button (4)
botox (5)

C
Cat (6)
cyber (1)

Here is what I got so far (it's not much), it displays all the categories in one long list:

sub {
my ($db,$sth,$row);
my $output="";

$db = $DB->table('Category');
$db->select_options("ORDER BY Name");
$sth = $db->select( ['ID','Name'] );

while ($row = $sth->fetchrow_hashref) {
$output .= qq|<br><a href="$CFG->{build_root_url}/$row->{ID}">$row->{Name}\n|;
}

$output .= qq|</a>|;

return $output;

}



If anyone could help me I would be grateful

Thanks

George
Subject Author Views Date
Thread Directory global (lists all categories) macbethgr 8290 Jul 22, 2002, 6:32 AM
Thread Re: [macbethgr] Directory global (lists all categories)
, 8142 Jul 22, 2002, 6:58 AM
Thread Re: [tpl] Directory global (lists all categories)
, 8169 Jul 22, 2002, 7:01 AM
Post Re: [tpl] Directory global (lists all categories)
Paul 8120 Jul 22, 2002, 7:52 AM
Thread Re: [macbethgr] Directory global (lists all categories)
macbethgr 8107 Jul 23, 2002, 10:19 AM
Thread Re: [macbethgr] Directory global (lists all categories)
webmaster33 8099 Jul 23, 2002, 11:12 AM
Thread Re: [webmaster33] Directory global (lists all categories)
macbethgr 8075 Jul 23, 2002, 11:33 AM
Thread Re: [macbethgr] Directory global (lists all categories)
Paul 8126 Jul 23, 2002, 11:43 AM
Thread Re: [Paul] Directory global (lists all categories)
webmaster33 8133 Jul 23, 2002, 11:46 AM
Thread Re: [webmaster33] Directory global (lists all categories)
macbethgr 8118 Jul 24, 2002, 5:25 AM
Thread Re: [macbethgr] Directory global (lists all categories)
webmaster33 8041 Jul 24, 2002, 6:07 AM
Thread Re: [webmaster33] Directory global (lists all categories)
macbethgr 8094 Jul 24, 2002, 6:15 AM
Post Re: [macbethgr] Directory global (lists all categories)
webmaster33 8012 Jul 24, 2002, 6:26 AM
Thread Re: [webmaster33] Directory global (lists all categories)
macbethgr 8015 Jul 24, 2002, 6:45 AM
Post Re: [macbethgr] Directory global (lists all categories)
webmaster33 7978 Jul 24, 2002, 7:10 AM
Thread Re: [macbethgr] Directory global (lists all categories)
webmaster33 8000 Jul 24, 2002, 7:32 AM
Thread Re: [webmaster33] Directory global (lists all categories)
macbethgr 7988 Jul 24, 2002, 9:01 AM
Post Re: [macbethgr] Directory global (lists all categories)
Paul 8065 Jul 24, 2002, 9:05 AM