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

Products: Gossamer Links: Development, Plugins and Globals: Re: [Piers1] Show random paid link: Edit Log

Here is the list of edits for this post
Re: [Piers1] Show random paid link
Hi,

Please try this (for the second problem);

Code:
sub {

my $cat = shift;
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 RAND() DESC LIMIT 10');

my $time = time;
my $cond = GT::SQL::Condition->new('CategoryID', 'IN', $all_ids);
my $cond2 = GT::SQL::Condition->new('isValidated','=','Yes','ExpiryDate','>', $time, 'ExpiryDate', '<', 2147483647);
my $sth = $db_obj->select (['Links.*'], $cond, $cond2 ) || die $GT::SQL::error;

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

if ($CFG->{build_detailed}) { $hit->{detailed_url} = $CFG->{build_root_url} . "/Detailed/$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; }

$hit->{isPaidLink} = 1;
$hit->{paymentsEnabled} = 1;

if ($hit->{LinkOwner} eq $USER->{Username}) {
$hit->{isLinkOwner} = 1;
}


push @links, $hit;
}

return { random_link => \@links }

}

...the first problem, I'm not sure there is a lot you can really do for that :(

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: Aug 25, 2008, 3:39 AM

Edit Log: