Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Re: [biglion] Displaying Multiple Categories for a Link: Edit Log

Here is the list of edits for this post
Re: [biglion] Displaying Multiple Categories for a Link
Hi,

Try this:

Call the global "get_cats_in", with the following code:

Code:
sub {
my $tag = shift;
my $sth = ('CatLinks')->select ( { LinkID => $tag->{ID} }, ['CategoryID'] ) || die $GT::SQL::error;

my @cats;
while (my $hit = $sth->fetchrow_hashref) {
my $cat = $DB->table('Category')->select( { ID => $hit->{CategoryID} } )->fetchrow_hashref;
my $cat_url = $DB->table('Category')->as_url($cat);
my $tmp; $tmp->{Name} = $cat; $tmp->{URL} = $cat_url;
push @cats, $tmp;
}

return { cats_in => \@cats };
}
Then, call with:

Code:
<%get_cats_in%>
<ul>
<%loop cats_in%>
<li><a href="<%URL%>"><%Name%></a></li>
<%endif%>
</ul>

Please note, this isn't tested - so may have some bugs (shouldn't do, but it may <G>)

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Aug 24, 2007, 8:09 AM

Edit Log: