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

Category URL on Category Pages?

Quote Reply
Category URL on Category Pages?
So how do I get the URL for a category page to show on that category page?

This should be a tag withing the GT system!

~ ERASER


Free JavaScripts @ Insight Eye
Quote Reply
Re: [Eraser] Category URL on Category Pages? In reply to
Hi,

A global should do it:

Code:
sub {
my $catID = $_[0];
my $tbl = $DB->table('Category');
my $name = $tbl->select( ['Full_Name'], { ID => $catID } )->fetchrow;
my $url = $tbl->as_url($name);
return $CFG->{build_root_url} . "/" . $url;
}

..then call with:

<%global_name($ID)%>

...on category.html

This may also work (shorter, and requires one less DB "select" call);

Code:
sub {
my $name = $_[0];
my $tbl = $DB->table('Category');
my $url = $tbl->as_url($name);
return $CFG->{build_root_url} . "/" . $url;
}

<%global_name($Full_Name)%>

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!
Quote Reply
Re: [Andy] Category URL on Category Pages? In reply to
Many thanks Andy Cool

~ ERASER


Free JavaScripts @ Insight Eye
Quote Reply
Re: [Andy] Category URL on Category Pages? In reply to
Hi Andy,

Using the first global

The output is fine as:
http://www.mysite.com/Ford/Cruger_xjs


But the actual URL is:
http://www.mysite.com/ford/cruger-xjs


Something to do with adding perhaps:
$cat->{URL} = "$CFG->{build_root_url}/" . $cat_table->as_url($cat->{Full_Name}) . "/";

(im using the StaticURLtr plugin)

~ ERASER


Free JavaScripts @ Insight Eye