Gossamer Forum
Home : Products : Gossamer Links : Discussions :

List of Categoies

Quote Reply
List of Categoies
Can I send list of LinkID and get all the category that the LinkID submit in.
So if I send list like “222,333,444,555,111,12” I will get list of category.
Quote Reply
Re: [nir] List of Categoies In reply to
You wanna submit a list of ID's, and then return ALL the categories those are listed in?

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] List of Categoies In reply to
YesSmile
Quote Reply
Re: [nir] List of Categoies In reply to
Should be pretty simple:

get_cats_for_links
Code:
sub {

my $link_ids;
foreach (split /,/, $_[0]) {
push @$link_ids, $_;
}

my $sth = $DB->table('CatLinks')->select( ['DISTINCT(CategoryID)'], GT::SQL::Condition->new('LinkID','IN',$link_ids) ) || die $GT::SQL::error;
my @categories;
while (my $cat_id = $sth->fetchrow) {
my $cat = $DB->table('Category')->get( { ID => $cat_ids } );
$cat->{URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $cat->{Full_Name} ) . "/" . $CFG->{build_index};
push @categories, $cat;
}

return { categorys_links_are_in_loop => \@categories };

}

..then call with:
Code:
<%get_cats_for_links('123,434,345,765')%>
<%loop categorys_links_are_in_loop%>
<%include subcategory.html%>
<%endloop%>

Untested, but should work Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] List of Categoies In reply to
Thanks, it's work