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

Re: [webmaster33] Showing all categories a link belongs to

Quote Reply
Re: [webmaster33] Showing all categories a link belongs to In reply to
I didn't realise it was such a small change I needed ... but that was exacly what I wanted Cool

I've changed the global slightly:

Code:
sub {
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table ('Category','CatLinks');
my $sth = $db->select ( { 'CatLinks.LinkID' => $id }, ['Category.ID', 'Category.Name', 'Category.Full_Name'] );
my $cat;
while (my ($id,$name,$fullname) = $sth->fetchrow_array) {
$name =~ s/ /_/g;
$cat .= "<a href=\"$CFG->{build_root_url}/$fullname\">$name</a> ";
}
return $cat;
}

This shows the category name itself, linked correctly even if it's a subcategory (the code above would show "Category/Subcategory"). Also, it now inserts "" around the hrefs (necessary for valid xhtml)

John
Subject Author Views Date
Thread Showing all categories a link belongs to gotze 2507 Apr 14, 2005, 1:30 PM
Thread Re: [gotze] Showing all categories a link belongs to
webmaster33 2393 Apr 14, 2005, 5:59 PM
Thread Re: [webmaster33] Showing all categories a link belongs to
gotze 2378 Apr 15, 2005, 2:19 PM
Thread Re: [gotze] Showing all categories a link belongs to
macbethgr 2365 Apr 17, 2005, 6:38 AM
Post Re: [macbethgr] Showing all categories a link belongs to
macbethgr 2314 Apr 18, 2005, 5:51 AM