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

Re: [Gorospe] Change Global

Quote Reply
Re: [Gorospe] Change Global In reply to
Something like this should do the trick (call it the same way you tried before)

Code:
sub {

my $cat = $_[0];
my $limit = $_[1] || 5;

my $all_ids = $DB->table('Category')->children($cat);
push @$all_ids, $cat;

my $db_obj = $DB->table('Links','CatLinks','Category');
$db_obj->select_options ("ORDER BY Add_Date DESC Limit $limit");

my $cond = GT::SQL::Condition->new('CategoryID', 'IN', $all_ids);
my $cond2 = GT::SQL::Condition->new('isValidated','=','Yes','isNew','=','Yes','isRevista','=','Yes');
$cond2->bool("AND");
my $sth = $db_obj->select (['Links.*'], $cond, $cond2 ) || die $GT::SQL::error;

my @cats;
while (my $hit = $sth->fetchrow_hashref) {

if ($CFG->{build_detailed}) { $hit->{detailed_url} = $CFG->{build_root_url} . "/" . $DB->table('Links')->detailed_url( $hit->{ID} ); }

if ($hit->{isNew} eq "Yes") { $hit->{isNew} = 1; } else { $hit->{isNew} = 0; }
if ($hit->{isPopular} eq "Yes") { $hit->{isPopular} = 1; } else { $hit->{isPopular} = 0; }
if ($hit->{isChanged} eq "Yes") { $hit->{isChanged} = 1; } else { $hit->{isChanged} = 0; }

push @cats, $hit;
}

return { latest_links_per_category => \@cats }

}

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!
Subject Author Views Date
Thread Change Global Gorospe 7282 Aug 17, 2010, 10:14 AM
Thread Re: [Gorospe] Change Global
Andy 7171 Aug 17, 2010, 10:46 PM
Thread Re: [Andy] Change Global
Gorospe 7127 Aug 18, 2010, 3:39 AM
Thread Re: [Gorospe] Change Global
Andy 7135 Aug 18, 2010, 5:02 AM
Thread Re: [Andy] Change Global
Gorospe 7107 Aug 18, 2010, 10:27 AM
Thread Re: [Gorospe] Change Global
Andy 7116 Aug 18, 2010, 11:46 AM
Thread Re: [Andy] Change Global
Gorospe 7095 Aug 18, 2010, 12:44 PM
Thread Re: [Gorospe] Change Global
Andy 7100 Aug 19, 2010, 12:38 AM
Thread Re: [Andy] Change Global
Gorospe 7055 Aug 19, 2010, 4:29 PM
Post Re: [Gorospe] Change Global
Andy 7040 Aug 19, 2010, 11:31 PM