Gossamer Forum
Quote Reply
Using as_url
 
sub {
my $tags = shift;
my $lnkid = $tags->{'ID'};
my $db = $DB->table ('Category','CatLinks');
my $catname = $db->select ( { LinkID => $lnkid }, ['Full_Name'] )->fetchrow;
return $CFG->{build_root_url} . "/" . $catname . "/";
}


That returns a full category name from a link ID. The only issue is the output is like:

site.com/Cars/Ford Cruger/


rather than a correct category output:

site.com/cars/ford-escort/


This code I believe gives the correct result, but I'd be damed if I can integrate this right!

return $CFG->{build_root_url} . "/" . $cat_table->as_url($cat->{Full_Name}) . "/";

Any help really appreciated.

~ ERASER


Free JavaScripts @ Insight Eye
Quote Reply
Re: [Eraser] Using as_url In reply to
Hi,

I believe tihs should work:

Code:
sub {
my $tags = shift;
my $lnkid = $tags->{'ID'};
my $db = $DB->table ('Category','CatLinks');
my $catname = $db->select ( { LinkID => $lnkid }, ['Full_Name'] )->fetchrow;
return $CFG->{build_root_url} . "/" . $DB->table ('Category')->as_url( { Full_Name => $catname } ) . "/";
}

If not, it may be you need to get the CategoryID, and then do:

Code:
return $CFG->{build_root_url} . "/" . $DB->table ('Category')->as_url( { ID => $catid } ) . "/";

Hope that helps.

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!