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
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