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

need a global for father catname

Quote Reply
need a global for father catname
Hi,

i need a global for the category pages

i want to display the Name of the Fathercat

please help

marina
Quote Reply
Re: [mkoenig] need a global for father catname In reply to
A please would be nice ;)

Code:
sub {

my $FatherID = shift;

my $sth = $DB->table('Category')->select( { ID => $FatherID } ) || return $GT:;SQL::error;
my $Father;
while (my $hit = $sth->fetchrow_hashref) {
$Father = $hit->{Full};
}

$Father ? return $Father : return "Couldnt find a match for ID : $FatherID";

}

Call it with;

<%global_name($FatherID)%>


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] need a global for father catname In reply to
Hi Andy

if i use this i get an -- Unable to compile 'Fathername' --

Fathername is the name of my global

i don't know why

please help again

marina
Quote Reply
Re: [mkoenig] need a global for father catname In reply to
Whoops Blush Please replace;

$GT:;SQL::error

with

$GT::SQL::error

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] need a global for father catname In reply to
Thank you andy

but now i always get -- Couldnt find a match for ID : ....

but the ID is correct

marina
Quote Reply
Re: [mkoenig] need a global for father catname In reply to
Sorry, should be;

$Father = $hit->{Name};


.. instead of;

$Father = $hit->{Full};

Had my Ace_News category field names stuck in my head :p

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] need a global for father catname In reply to
WinkWink Thank you very much SlySly

marina
Quote Reply
Re: [Andy] need a global for father catname In reply to
Hello Andy,

I have a question.

I have a category and four subcategory.
category - sub1 - sub2 - sub3 - sub4


I use this global to obtain the ID of the higher category.

For example, since subcategory 4, I obtain the ID of subcategory 3.
category - sub1 - sub2 - sub3 - sub4

Code:
sub {
my $FatherID = shift;
my $sth = $DB->table('Category')->select( { ID => $FatherID } ) || return $GT::SQL::error;
my $Father;
while (my $hit = $sth->fetchrow_hashref) {
$Father = $hit->{ID};
}
$Father ? return $Father : return "Couldnt find a match for ID : $FatherID";
}


My question.

It is possible to obtain the ID of the father 0 (category) since subcategory 4 ?

category - sub1 - sub2 - sub3 - sub4


Thank you for your assistance.

Mick