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!