Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [ryel01] link to link's category?

Quote Reply
Re: [ryel01] link to link's category? In reply to
you can either add:

Code:

my $catdb = $DB->table('CatLinks', 'Category');
my $catsth = $catdb->select ({ 'CatLinks.LinkID' => $id}, ["Category.Full_Name"]);
$link->{category} = $catsth->fetchrow_array;

to the while loop...

Or create a new global called "category":

Code:
sub {
my $vars = shift;
my $id = $vars->{ID};

my $table = $DB->table('CatLinks', 'Category');
my $sth = $table->select ({ 'CatLinks.LinkID' => $id}, ["Category.Full_Name"]);
my $name = $sth->fetchrow_array;

return $name;
}

Then in your template you can do:

Code:
<a href="<%build_root_url%>/<%category%>/index.html"><%Title%></a>

Philip
------------------
Limecat is not pleased.

Last edited by:

fuzzy logic: Mar 18, 2004, 8:18 AM
Subject Author Views Date
Thread link to link's category? ryel01 2169 Mar 18, 2004, 1:08 AM
Thread Re: [ryel01] link to link's category?
fuzzy logic 2091 Mar 18, 2004, 8:04 AM
Thread Re: [fuzzy logic] link to link's category?
ryel01 2085 Mar 18, 2004, 12:59 PM
Thread Re: [ryel01] link to link's category?
afinlr 2070 Mar 18, 2004, 3:13 PM
Thread Re: [afinlr] link to link's category?
ryel01 2058 Mar 18, 2004, 10:31 PM
Thread Re: [ryel01] link to link's category?
fuzzy logic 2041 Mar 18, 2004, 11:23 PM
Post Re: [fuzzy logic] link to link's category?
ryel01 2052 Mar 18, 2004, 11:42 PM
Post Re: [fuzzy logic] link to link's category?
ryel01 2030 Mar 19, 2004, 1:35 AM