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,

You can't do it quite like that :)

You need another global - check_if_paid_exists .. with this code:

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 Add_Date DESC LIMIT 1');

my $time = time;
my $cond = GT::SQL::Condition->new('CategoryID', 'IN', $all_ids);
my $cond2 = GT::SQL::Condition->new('isNew','=','Yes','isValidated','=','Yes','ExpiryDate','>', $time, 'ExpiryDate', '<', 2147483647);
my $count = $db_obj->count ( $cond, $cond2 ) || die $GT::SQL::error;

return { num_paid_found => $count }

}

..then use this:

Code:
<%num_paid_found($category_id)%>
<%if num_paid_found > 0%>
. ..
<%endif%>

Untested, but should work.

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: Apr 24, 2008, 5:29 AM

Edit Log: