I`m working with next global.
sub {
my $show_count = $_[0];
my $category;
my $db = $DB->table('Category') || return $GT::SQL::error;
$db->select_options('ORDER BY Full_Name') || return $GT::SQL::error;
my $sth = $db->select( ['ID','Full_Name','Number_of_Links'] ) || return $GT::SQL::error;
my $back;
while (my ($id,$full_name,$numberoflinks) = $sth->fetchrow_array) {
my $full_name2;
my @cut = split /\//, $full_name;
for (my $i=0; $i < $#cut; $i++) {
$full_name2 .= " ";
}
$full_name2 .= $cut[$#cut];
if ($show_count) {
$full_name2 .= " ($numberoflinks)</a></b><br>";
}
my $cid =$IN->param('catid') || $IN->param('CatLinks/CategoryID') || 0;
if ($cid == $id) {
$back .= qq{$id - $full_name2};
} else {
$back .= qq{<b>$id - <a href=\"$CFG->{build_root_url}\">$full_name2};
}
}
my $send_back = qq|$back|;
return $send_back;
}
It generates
category
subcat1
subcat2
list.
I`m trying to generate a link to category.
<a href="full url to the category">category</a>
<a href="full url to the category">subcat1</a>
etc
please help to modify this global.
sub {
my $show_count = $_[0];
my $category;
my $db = $DB->table('Category') || return $GT::SQL::error;
$db->select_options('ORDER BY Full_Name') || return $GT::SQL::error;
my $sth = $db->select( ['ID','Full_Name','Number_of_Links'] ) || return $GT::SQL::error;
my $back;
while (my ($id,$full_name,$numberoflinks) = $sth->fetchrow_array) {
my $full_name2;
my @cut = split /\//, $full_name;
for (my $i=0; $i < $#cut; $i++) {
$full_name2 .= " ";
}
$full_name2 .= $cut[$#cut];
if ($show_count) {
$full_name2 .= " ($numberoflinks)</a></b><br>";
}
my $cid =$IN->param('catid') || $IN->param('CatLinks/CategoryID') || 0;
if ($cid == $id) {
$back .= qq{$id - $full_name2};
} else {
$back .= qq{<b>$id - <a href=\"$CFG->{build_root_url}\">$full_name2};
}
}
my $send_back = qq|$back|;
return $send_back;
}
It generates
category
subcat1
subcat2
list.
I`m trying to generate a link to category.
<a href="full url to the category">category</a>
<a href="full url to the category">subcat1</a>
etc
please help to modify this global.