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

Global for subcats of fathercats

Quote Reply
Global for subcats of fathercats
Hi everybodyWink

i am lookíng for a Global like this one

sub { my $tags = shift;
my $cat_db = $DB->table('Category');
my @root_cats = $cat_db->select (['Full_Name'], { FatherID => 0 })->fetchall_list;
my $output; foreach my $root_cat (@root_cats) { my $url = $cat_db->as_url($root_cat);
$output .= qq~<a href="$CFG->{build_root_url}/$url">$root_cat"</a><br>~; } return $output; }

This Globals shows only the rootcat (FatherID => 0)

i want to show the subcats of fathercats on every category

can you help mePirate

marina Sly
Quote Reply
Re: [mkoenig] Global for subcats of fathercats In reply to
Pretty simple (if I understand what you are asking for);

Code:
sub {

my $ID = $_[0] || 0;
my $cat_db = $DB->table('Category');

my @root_cats = $cat_db->select (['Full_Name'], { FatherID => $ID })->fetchall_list;

my $output;
foreach my $root_cat (@root_cats) {
my $url = $cat_db->as_url($root_cat);
$output .= qq~<a href="$CFG->{build_root_url}/$url">$root_cat"</a><br>~;
}

return $output; }

Call it with;

<%global_name($ID)%> (you need to use this in subcategory.html, or category.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 for subcats of fathercats In reply to
Hi Andy

it is not what i mean

Example

cat1
Cat2
Cat2-1
Cat2-2
Cat3
Cat4

if category site is cat2 i want so display cat3 and cat4

if category site is cat2-1 i want so display cat2-2

hope you understand me

Marina
Quote Reply
Re: [mkoenig] Global for subcats of fathercats In reply to
Afraid I don't understand :(

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 for subcats of fathercats In reply to
I'am sorry
new try

_____Category_1
. |______Category_1_1
. |______Category_1_2
. |______Category_1_3
. ............. |_Category_1_3_1


If a call Category_1_1
i want to display the subcategory of Category_1

in this case The result is:
Category_1_1 , Category_1_2 and Category_1_3

hope you understand

Marina
Quote Reply
Re: [mkoenig] Global for subcats of fathercats In reply to
http://www.gossamer-threads.com/...i?post=243460#243460
Quote Reply
Re: [Andy] Global for subcats of fathercats In reply to
Hi Andy

how can i use only the Name of the category instead of Full_Name for my linktext

Marina