Gossamer Forum
Quote Reply
Add subcategory...
Hello,

I modified this Global.

<%Add_list_sub($ID)%>
----------------------------
sub {
my $ID = $_[0] || 0;
my $cat_db = $DB->table('Category');
my @id_cats = $cat_db->select (['ID'],
{ FatherID => $ID })->fetchall_list;
my $output;
foreach my $root_add (@id_cats) {
$output .= qq~<a href="$CFG->{db_cgi_url}/add.cgi?ID=$root_add">$root_add</a><br>~;
}
return $output;
}
--------------------------

It gives number ID of a list of subcategory.

I would like that the Global one gives with number ID the name of the category.

$output .= qq~<a href="$CFG->{db_cgi_url}/add.cgi?ID=$root_add">$root_add</a><br>~;

I would like to replace $root_add with $Name.

I do not manage to find a solution. You have an idea?

Thank you for your assistance.

Mick

Last edited by:

mick31: Oct 17, 2004, 9:56 AM
Quote Reply
Re: [mick31] Add subcategory... In reply to
Something like this:

sub {
my $ID = $_[0] || 0;
my $cat_db = $DB->table('Category');
my $sth = $cat_db->select (['ID','Name'], { FatherID => $ID });
my $output;
while (my ($id,$name) = $sth->fetchrow_array) {
$output .= qq~<a href="$CFG->{db_cgi_url}/add.cgi?ID=$id">$name</a><br>~;
}
return $output;
}

Last edited by:

afinlr: Oct 17, 2004, 11:11 AM
Quote Reply
Re: [afinlr] Add subcategory... In reply to
Hello Afinir,

It works very well.

That seems so simple for you!

I appreciate much your assistance

Mick