Gossamer Forum
Home : Products : Gossamer Links : Discussions :

specific link selected by category

Quote Reply
specific link selected by category
Hi,

I want to be able to display a specific link on a category page, i am doing this with a global but I currently have to specify the link ID on the template.

But what I need is for the specific Link ID to be specified in a category column.

This means that I might have a category called "category1", in this category there is a column called Review. This column review contains what the link ID should be.

This is the global Im using to display a selected link on a category page:

sub {
my $id= shift;
my $link = $DB->table('Links')->get($id);
require Links::SiteHTML; # not sure if needed
return $link->{ID} ? Links::SiteHTML::display('link_review', $link) : '';
}

Then I use <%load_link(ID)>, this as I said means I have to specify the ID in the template.

I would like to use above but the ID specified by the category.

I need this so I can display a certain link (through a template) on a category, but the category itself decides (through a column in category) what Link it should be. This is since I have hundreds of different categories and I really do not want to use different templates for each and every category. If I could use a column in category to decide what link to display that would save a lot of time. Im sure there is a easy way to use above global but to get the link ID from the category database.

Any idea?

Thanks!
Quote Reply
Re: [demon] specific link selected by category In reply to
You should just be able to use:

<%load_link($Review)%>
Quote Reply
Re: [afinlr] specific link selected by category In reply to
Thanks! That works perfect. Didnt realise it was that simple!