Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Related Links and Categories ?

Quote Reply
Related Links and Categories ?
Hi,

Related Links
I've been reading through the search results about related links and this doesn't seem to be a part of the standard Links 3, but I'm not really sure from reading the different posts.

First of all I don't understand where or how you define one link is related to another. I get the impression it's a manual job that is required to get a link to be related to another from the below post.

I'd also like to be able to display related links in a category. This seems to also be covered in this post : http://www.gossamer-threads.com/...i?post=158775#158775

Link in different categories
Say I have a canadian singer and want to put them in the category "Canada" but also in the category "International Singers" but that I'd also like to have down as a related link in the category "Celtic Music".

Issues searching links that are in different categories
I don't really understand how searching works when you choose to put a link in two categories. In the above example without having got so far as understanding how to create a related link, the link that is associated to two categories ("Canada" and "International Singers") only appears in one and nothing indicates that it is also in another.
What defines which category is displayed in the search or which category is displayed in a list as the category the link belongs to if only one is displayed ?

If somebody could explain the concepts involved it would be much appreciated !

Thanks, John
Significant Media
Quote Reply
Re: [Jag] Related Links and Categories ? In reply to
John, I can't help with related links but I might be able to help you with with links listed in multiple categories...

Each link has a 'main' category and then the extra categories it is listed in. I found the easiest way to handle this was not to group search results by category (build_search_gb=No in Search Options). In link.html you can then include a list of the categories a link is listed under by using a global, call it get_link_cats (relevant to all pages using link.html, not just Search):

Code:
sub {
require Links::Build;
my $id = shift;
my $cat_db = $DB->table('Category');
my $catlink = $DB->table('CatLinks','Category');
$catlink->select_options ('ORDER BY Full_Name ASC');
my @names = $catlink->select ({ LinkID => $id }, ['Full_Name'])->fetchall_list;
my @link_cats;
for (@names) {
push @link_cats, { cat_name => Links::Build::build ('title_unlinked',$_), cat_url => $cat_db->as_url($_)};
}
return { link_cats => \@link_cats };
}

Then call the global like this (rough HTML only Wink):

Code:
Listed in:
<%get_link_cats($ID)%>
<%loop link_cats%>
<a href="/<%cat_url%>"><%cat_name%></a>&nbsp;
<%endloop%>

I would have found these globals here somewhere probably so full credit to the original author Wink.

I'm not sure if this helps you or not. This is for a site using Links 2. I am having similar issues with multi-category links in Links 3 with respect to the breadcrumb trail (you can follow a link down from an alternative category to the detailed page level and then have the breadcrumb change to the 'main' category).
Quote Reply
Re: [aus_dave] Related Links and Categories ? In reply to
Hi Dave,

That's very interesting I'll need some time to figure out how it works and how I can use it but I'll keep you posted ! Thanks very much Wink

John
Significant Media