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

Products: Gossamer Links: Development, Plugins and Globals: Re: [jupp] Count special Links with a Global: Edit Log

Here is the list of edits for this post
Re: [jupp] Count special Links with a Global
Hi. Does this global work any better?

Code:
sub {

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

my $full_name = $cat_db->select ( ['Full_Name'], { 'ID' => $cat_id })->fetchrow;
if !$full_name return "Invalid category ID passed...";

my $sth = $cat_db->select( GT::SQL::Condition->new('Full_Name','LIKE',"$full_name%") ) || return $GT::SQL::error;

my @ids;
while (my $hit = $sth->fetchrow_hashref) {
push(@ids,$hit->{ID});
}

my $count = $DB->table('CatLinks','Links')->count( GT::SQL::Condition->new( 'statistik','=','1','CategoryID', 'IN', \@$ids) );

$count ? return $count || return 0;

}

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: May 27, 2004, 6:03 AM

Edit Log: