Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How can I put link category on the detailed page?

Quote Reply
How can I put link category on the detailed page?
  
A lot of my traffic enters on my detailed pages, and I would like those visitors to be able to easily see other links in that same category. Unfortunately I can't find any tag that will put the link category on the detailed page. It seems it should be possible somehow. I have tried using the same tag that is in the admin area that shows which category a link is in, but it doesn't work. The search results also shows the category of a link, but I couldn't get that tag to work on a detailed page. Since the database obviously knows what category the links are in, isn't there some way to call that info on the detailed pages?? I tried <%GT::Template::dump%> on that page, but nothing. Is there a mod that will allow an additional tag for that page?? It sure does seem like a logical bit of info to place on the detailed pages. Any ideas?

Thanks,

Rich
--
Listen to Hawaiian music at
HawaiianRainbow.com

Last edited by:

richonmaui: Oct 20, 2004, 8:48 PM
Quote Reply
Re: [richonmaui] How can I put link category on the detailed page? In reply to
Hi. Is this any help?

http://www.sqlwidgets.com/...ces/Detailed/10.html

Chers

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 can I put link category on the detailed page? In reply to
In Reply To:
Hi. Is this any help?

http://www.sqlwidgets.com/...ces/Detailed/10.html

Chers
Hey Andy - That works great. Is there a way to write this <%detailed_cat_bread($ID)%> so it will show more than one category when appropriate??

Thanks

Rich

Last edited by:

richonmaui: Oct 21, 2004, 2:29 AM
Quote Reply
Re: [richonmaui] How can I put link category on the detailed page? In reply to
Mmm.. I guess so. Something like this should work; (I'm a bit rushed, so I apologise in advance if it doesn't work ;)).

Code:
sub {
my $id = $_[0];
my $db = $DB->table ('Category');
my $db2 = $DB->table ('CatLinks');

my @categoryIDs = $db2->select( ['CategoryID'],{ LinkID => $id } )->fetchrow_array;

my ($title_linked,$cat);
foreach (@categoryIDs) {
$cat = $db->get ($_, 'HASH', ['Name','Full_Name']);
$title_linked .= Links::Build::build ('title_linked', $cat->{Full_Name} . '/' . ' ');
}

return $title_linked;
}

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: Oct 21, 2004, 2:45 AM
Post deleted by richonmaui In reply to
Quote Reply
Re: [richonmaui] How can I put link category on the detailed page? In reply to
Sorry, give the modified version a go. Should work now Smile

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 can I put link category on the detailed page? In reply to
In Reply To:
Sorry, give the modified version a go. Should work now Smile

Cheers
Still only showing one category when there should be two. I'll follow up tomorrow with code for something that is working ok, but is not as satisfactory as the breadcrumbs would be. Too tired to do it now.

Rich
Quote Reply
Re: [richonmaui] How can I put link category on the detailed page? In reply to
Ok, here's something that works to show more than one category, but it's not in a breadcrumb format - just each final category:
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 };
}
This is called on the page by:
Code:
<%get_link_cats($ID)%>
<%loop link_cats%>
<a href="<%build_root_url%>/<%cat_url%>"><%cat_name%><br>
<%endloop%>

Any way to adapt this to show the breadcrumb format and multiple category links?

Thanks

Rich
Quote Reply
Re: [richonmaui] How can I put link category on the detailed page? In reply to
You could try this (in the template loop);

<%Links::Build::build ('title_linked', $cat_url . '/')%>

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 can I put link category on the detailed page? In reply to
Thanks for your help Andy, but I can't get the breadcumbs to show multiple categories. I have decided not to worry about it. I'm going to go with your original suggestion as it's very clean:

http://www.sqlwidgets.com/...ces/Detailed/10.html

Thanks again

Rich

Quote Reply
Re: [richonmaui] How can I put link category on the detailed page? In reply to
Try this

sub {
my $tags = shift;
my $id = $tags->{'ID'};
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { LinkID => $id }, ['Name','Full_Name'] );
my $cat;
while (my ($name,$full_name) = $sth->fetchrow_array) {
my $test = Links::Build::build('title_linked', $full_name);
$cat .= qq~<li>$test<br>~;
}
return $cat;
}
Quote Reply
Re: [afinlr] How can I put link category on the detailed page? In reply to
In Reply To:
Try this

sub {
my $tags = shift;
my $id = $tags->{'ID'};
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { LinkID => $id }, ['Name','Full_Name'] );
my $cat;
while (my ($name,$full_name) = $sth->fetchrow_array) {
my $test = Links::Build::build('title_linked', $full_name);
$cat .= qq~<li>$test
~;
}
return $cat;
}
This gives me an error:

A fatal error has occured:
Can't use string ("2833") as a HASH ref while "strict refs" in use at (eval 31) line 3.



Quote Reply
Re: [richonmaui] How can I put link category on the detailed page? In reply to
Hi,

That's because you're passing in the ID - just change these lines

my $tags = shift;
my $id = $tags->{'ID'};

to

my $id = shift;
Quote Reply
Re: [afinlr] How can I put link category on the detailed page? In reply to
That does work, but the end category that the link is in is not a clickable link, which defeats the original purpose. Andy's first suggestion still seems to work easiest and best for me:
http://www.sqlwidgets.com/...ces/Detailed/10.html

Thanks,

Rich

Quote Reply
Re: [richonmaui] How can I put link category on the detailed page? In reply to
To make the last link clickable change this line:

my $test = Links::Build::build('title_linked', { name => $full_name, complete => 1 });
Quote Reply
Re: [afinlr] How can I put link category on the detailed page? In reply to
Ok, that works great, showing multiple category links (when appropriate) on the detailed pages.

Here's the whole thing in one place:

Create a new global: LSQL Admin > Build > Template Globals

global name: get_link_cats


sub {
my $id = shift;
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { LinkID => $id }, ['Name','Full_Name'] );
my $cat;
while (my ($name,$full_name) = $sth->fetchrow_array) {
my $test = Links::Build::build('title_linked', { name => $full_name, complete => 1 });
$cat .= qq~<li>$test<br>~;
}
return $cat;
}


use this to call the global on the page:

<%get_link_cats($ID)%>
<%loop link_cats%>
<a href="<%build_root_url%>/<%cat_url%>"><%cat_name%><br>
<%endloop%>

Quote Reply
Re: [richonmaui] How can I put link category on the detailed page? In reply to
In Reply To:
Ok, that works great, showing multiple category links (when appropriate) on the detailed pages.
Here's the whole thing in one place: Create a new global: LSQL Admin > Build > Template Globals global name: get_link_cats

sub {
my $id = shift;
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { LinkID => $id }, ['Name','Full_Name'] );
my $cat;
while (my ($name,$full_name) = $sth->fetchrow_array) {
my $test = Links::Build::build('title_linked', { name => $full_name, complete => 1 });
$cat .= qq~<li>$test
~;
}
return $cat;
}

use this to call the global on the page:
<%get_link_cats($ID)%>
<%loop link_cats%>
<a href="<%build_root_url%>/<%cat_url%>"><%cat_name%>
<%endloop%>



I would also like to display the ID of each category... do you have an idea? what are the lines I have to modify?

txs
FMPWink
Quote Reply
Re: [fmp] How can I put link category on the detailed page? In reply to
Hi, I have done the following... it is probably not the best way to do it but it works...

sub {
my $tags = shift;
my $link_id = $tags->{ID};
my $link_db = $DB->table ('Links');
my ($cat_id, $cat_name) = each %{$link_db->get_categories ($link_id)};
my $output = qq~
$cat_id
~;
return $output;
}


FMPSmile
Quote Reply
Re: [afinlr] How can I put link category on the detailed page? In reply to
Hi Afinlr,

I discover that you wrote this global used several times in the forum.

I have difficulties to adapt it to my need.

It is here detailed.
http://www.gossamer-threads.com/...i?post=292824#292824

Thank you for your assistance.

Oyo

Last edited by:

Oyo: Jul 29, 2006, 3:34 AM