Gossamer Forum
Quote Reply
Name of rootcat
Hi everybody

How can i get the Name of the rootcat on category pages and detail pages

MarinaSly
Quote Reply
Re: [mkoenig] Name of rootcat In reply to
Try this global;

Code:
sub {

# passed as <%global_name($ID,'detail')%>
# or <%global_name($ID,'category')%>

my $ID = $_[0]; # either pass in a category ID, or link ID
my $do = $_[1];

if ($do eq "detail") {

my $cat_id = $DB->table('CatLinks')->select( ['CategoryID'], { LinkID => $ID } )->fetchrow || return $GT::SQL::error;

my $full_name = $DB->table('Category')->select( ['Full_Name'], { ID => $cat_id } )->fetchrow || return $GT::SQL::error;

my @cat_cut = split /\//, $full_name;

$cat_cut[0] ?
return $cat_cut[0] :
return "couldnt find category ID $cat_id and link ID $ID...";


} else {

my $full_name = $DB->table('Category')->select( ['Full_Name'], { ID => $ID } )->fetchrow || return $GT::SQL::error;

my @cat_cut = split /\//, $full_name;

$cat_cut[0] ?
return $cat_cut[0] :
return "couldnt find category ID $ID ...";

}

}

Simply call it as follows;

Detailed;
<%global_name($ID,'detail')%>

Category Page;
<%global_name($ID,'category')%>

Hope that helps/works :)

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!

Last edited by:

Andy: Feb 2, 2004, 12:39 AM
Quote Reply
Re: [Andy] Name of rootcat In reply to
Hi Andy

it does not work

Unable to compile

sorry MarinaPirate
Quote Reply
Re: [mkoenig] Name of rootcat In reply to
Sorry, I used $action instead of $do Frown

Please give the modified version a go :)

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] Name of rootcat In reply to
Hi Andy

now it works
but the global display the full_Name of the Category
an not the the name of the rootcat (ID=0)


MarinaSly
Quote Reply
Re: [mkoenig] Name of rootcat In reply to
Oh, in that case... how does the modified global work?

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] Name of rootcat In reply to
great work

Thank you andy

bye MarinaSly