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

How to show list of categories particular link is asigned to in detailed.html?

Quote Reply
How to show list of categories particular link is asigned to in detailed.html?
Is there a possibility to show a list of all categories that a particular link is belong to in detailed.html pages?

Example a link to New York Times newspaper is listed under:
1. USA Top 40 Newspaper
2. New York State
3. New York City
4. World Top 100 newspapers categories

How can i show this info under detailed.html page?

Thanks in advance!
Quote Reply
Re: [AMIXIMA] How to show list of categories particular link is asigned to in detailed.html? In reply to
Sure, shouldn't be too hard - try something like: (tested it locally, and works ok for me)

other_categories
Code:
sub {
my $link_id = $_[0];
my $tbl = $DB->table('CatLinks','Links','Category');
$tbl->select_options('ORDER BY Name');

my $sth = $tbl->select( ['Category.*'], GT::SQL::Condition->new('CatLinks.LinkID','=',$link_id) ) || die $GT::SQL::error;

my @loop;
while (my $hit = $sth->fetchrow_hashref) {
$hit->{URL} = $CFG->{build_root_url} . "/" . $DB->table('Category')->as_url( $hit->{Full_Name} ) . "/" . $CFG->{build_index};
push @loop, $hit;
}

return { loop_other_categories => \@loop };
}

Then call with:

Code:
<%other_categories($ID)%>
<%if loop_other_categories.length%>
<ul>
<%loop loop_other_categories %>
<li><a href="<%URL%>"><%Name%></a></li>
<%endloop%>
</ul>
<%endif%>


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!
Quote Reply
Re: [Andy] How to show list of categories particular link is asigned to in detailed.html? In reply to
Smile Thanks Andy for the quick reply. It works flowless!!!

I really appreciate your time.

Armen