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

Re: [Andy] Cats of a Links

Quote Reply
Re: [Andy] Cats of a Links In reply to
Small error there: You missed an = in the code. This works for me:

Code:
sub {
my $LinkID = $_[0];
my $sth = $DB->table("CatLinks")->select( ['CategoryID'], { LinkID => $LinkID });
my (@cat_ids,@cats);
while (my $cat_id = $sth->fetchrow) {
push @cat_ids, $cat_id
}

my $Category = $DB->table("Category");
$Category->select_options("ORDER BY Name DESC");
my $sth_cats = $Category->select( GT::SQL::Condition->new('ID','IN',\@cat_ids) );
while (my $cat = $sth_cats->fetchrow_hashref) {
$cat->{URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $cat->{Full_Name} ) . "/" . $CFG->{build_index};
push @cats, $cat;
}

return { cats_in_loop => \@cats }
}
Subject Author Views Date
Thread Cats of a Links Robert 9114 May 23, 2017, 6:40 AM
Thread Re: [Robert] Cats of a Links
Andy 8844 May 23, 2017, 6:51 AM
Thread Re: [Andy] Cats of a Links
gotze 7541 Aug 1, 2018, 7:55 AM
Thread Re: [gotze] Cats of a Links
Andy 7518 Aug 2, 2018, 10:10 PM
Thread Re: [Andy] Cats of a Links
gotze 7509 Aug 3, 2018, 12:37 AM
Post Re: [gotze] Cats of a Links
Andy 7489 Aug 3, 2018, 2:55 PM