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

Global to show Main Category (Father) of the subcategories.

Quote Reply
Global to show Main Category (Father) of the subcategories.
Hi All,

Does anybody knows how to show the category-name of the father?(id).

example:

I have a main category named FLOWERS
Within FLOWERS I have a subcat REDFLOWERS.

When I am in category REDFLOWERS then all the links must have the FLOWERS main category mentioned.
(I will put the global in link.html of course)

Thanks,
Ron
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
There are a number of ways, each with a different amount of overhead.

What exactly are you trying to do? There are tags and functions that will return various paths, linked paths, and such.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
You could try something like;

<%global_name($ID)%> (this will work in link.html).

Code:
sub {

my $ID = $_[0];
my $FATHERID = $DB->table('CatLinks')->select( ['CategoryID'], { LinkID => $ID } )->fetchrow;
my $name = $DB->table('Category')->select( ['Name'], { ID => $FATHERID })->fetchrow;

$name ? return $name : return 'No name found';

}

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!

Last edited by:

Andy: Oct 2, 2004, 4:59 AM
Quote Reply
Re: [Andy] Global to show Main Category (Father) of the subcategories. In reply to
Thanks for replying...

It comes with "no name found"
I placed it in link.html

thanks,
ron
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
Mmm.. which template are you using? Can you try adding;

TEST: <%FatherID%>

... and see what that gives you?

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] Global to show Main Category (Father) of the subcategories. In reply to
this is the result, Andy:

No name found TEST: Unknown Tag: 'FatherID'


I use the SIMPLE template...

thanks,
ron
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
Mmm.... which template are you putting this in? How are you calling this template?

FatherID is a required field in link.html and category.html ... and I know for a fact that it should be accessable. Makes me wonder whats not quite right.... :/ (the global is fine, as I just tried it out on our install Smile).

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] Global to show Main Category (Father) of the subcategories. In reply to
Hi Andy,

It works in Category Template but NOT in the link.html template... (No name)

(Test : <%FatherID%> gives me also an ID Number in category.html and NOT in link.html)

Thanks,
ron

Last edited by:

sahertianr: Oct 2, 2004, 5:00 AM
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
Please try the modified version :)

http://www.gossamer-threads.com/...i?post=273205#273205

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] Global to show Main Category (Father) of the subcategories. In reply to
Hi Andy,

Nothing...

My category.html gives a result on this: <%FatherID%> with an ID.
MY link.html gives this as a result: Unknown Tag: 'FatherID'

I am using the simple template and I don't understand why it isn't parsed with link.html

Thanks for so far...

cheers,
Ron
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
Are you using the new tag?

<%global_name($ID)%> (this will work in link.html).

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] Global to show Main Category (Father) of the subcategories. In reply to
Andy,

This one works in link.html and produces the actual sub-category where I am in. Not the main-category name (Father)...

Thanks,
ron
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
Ah, I see what you mean now =)

Try the same global (you can call it the same way too), with;

Code:
sub {
my $ID = $_[0];
my $FATHERID = $DB->table('CatLinks')->select( ['CategoryID'], { LinkID => $ID } )->fetchrow;
my $name = $DB->table('Category')->select( ['Full_Name'], { ID => $FATHERID })->fetchrow;

my @name_slice = split /\//, $name;

$name_slice[0] ? return $name_slice[0] : return 'No name found'; }

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: Oct 2, 2004, 9:13 AM
Quote Reply
Re: [Andy] Global to show Main Category (Father) of the subcategories. In reply to
oooops,

internal server error 500 with this one......
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
Mmm... looks like it may be this line;

Code:
my @name_slice = split |/|, $name;

Try changing it to;

Code:
my @name_slice = split /\//, $name;

I'm off for the night now .... been a long day :/

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] Global to show Main Category (Father) of the subcategories. In reply to
SmileWink
YES.....

That's the one!!!!

Great...
Many thanks,
Ron
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
Hi Andy,

As a small addition to the question above...
I want to include an image or a piece of text when fatherid matches a number?
Must it be like this. I tried several statements... unfortunately.....

<%if type_tone($ID) = 1000%>
SHOW THIS IMAGE OR TEXT OR INCLUDE(a certain file)
<%elseif type_tone($ID) = 2000%>
SHOW THAT IMAGE OR TEXT OR INCLUDE(a certain file)
<%endif%>

Am I on right track here?

Thanks,
Ron
Quote Reply
Re: [sahertianr] Global to show Main Category (Father) of the subcategories. In reply to
Try changing the last line of Andy's global to

$name_slice[0] ? return {TypeT => $name_slice[0]} : return {TypeT => 'No name found'};

Then you should be able to use

<%type_tone($ID)%>
<%if TypeT eq '1000'%>
SHOW THIS IMAGE OR TEXT OR INCLUDE(a certain file)
<%elseif TypeT eq '2000'%>
SHOW THAT IMAGE OR TEXT OR INCLUDE(a certain file)
<%endif%>
Quote Reply
Re: [afinlr] Global to show Main Category (Father) of the subcategories. In reply to
Works!!!

Afinlr and Andy,
The greatest.... on this forum!