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

Re: [Andy] Great global but little problem....

Quote Reply
Re: [Andy] Great global but little problem.... In reply to
This is really curious as I did post something.

Any way here is it:

This global is great: it allows me to display on the front page the latest xx links. However, there is a problem when a link belongs to several categories: it appears duplicated. For example, if a link belongs to 3 categories, the global will diplay it 3 times.

So what should I add so no matter how much categories a links belongs to, it will be displayed only once ?

Thanks in advance,
Brakkar

Quote:
sub {
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links','CatLinks');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 30');
my $cats = [35,42];
my $cond = GT::SQL::Condition->new( 'CategoryID','IN', $cats); $cond->not; my $cond2 = GT::SQL::Condition->new($cond, 'isValidated','=','Yes'); $sth = $search_db->select ( $cond2 ); my $x = 0; while ($link = $sth->fetchrow_hashref) {
$link->{'detailed_url'} = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
Links::init_date();
$link->{Add_Date} = GT::Date::date_transform ($link->{Add_Date}, $CFG->{date_db_format}, $CFG->{date_user_format});
if ($x < 15) {
$output .= Links::SiteHTML::display('linkfront', $link);
}
else {
$output .= Links::SiteHTML::display('linkfront', $link);
}
$x++;
}
return $output;
}
Subject Author Views Date
Thread Great global but little problem.... brakkar 6752 Mar 8, 2004, 4:49 AM
Thread Re: [brakkar] Great global but little problem....
Andy 6534 Mar 8, 2004, 5:32 AM
Thread Re: [Andy] Great global but little problem....
brakkar 6490 Mar 8, 2004, 6:47 AM
Thread Re: [brakkar] Great global but little problem....
afinlr 6521 Mar 8, 2004, 8:46 AM
Thread Re: [afinlr] Great global but little problem....
brakkar 6492 Mar 8, 2004, 9:40 AM
Thread Re: [brakkar] Great global but little problem....
afinlr 6540 Mar 8, 2004, 9:49 AM
Thread Re: [afinlr] Great global but little problem....
brakkar 6502 Mar 8, 2004, 10:13 AM
Thread Re: [brakkar] Great global but little problem....
afinlr 6489 Mar 8, 2004, 10:19 AM
Thread Re: [afinlr] Great global but little problem....
brakkar 6426 Mar 12, 2004, 4:10 PM
Thread Re: [brakkar] Great global but little problem....
fuzzy logic 6482 Mar 12, 2004, 5:01 PM
Thread Re: [fuzzy logic] Great global but little problem....
brakkar 6458 Mar 12, 2004, 5:33 PM
Thread Re: [brakkar] Great global but little problem....
fuzzy logic 6434 Mar 12, 2004, 5:57 PM
Post Re: [fuzzy logic] Great global but little problem....
brakkar 6426 Mar 12, 2004, 6:03 PM
Thread Re: [fuzzy logic] Great global but little problem....
brakkar 6443 Mar 12, 2004, 6:07 PM
Thread Re: [brakkar] Great global but little problem....
fuzzy logic 6430 Mar 12, 2004, 6:19 PM
Thread Re: [fuzzy logic] Great global but little problem....
brakkar 6399 Mar 12, 2004, 6:23 PM
Post Re: [brakkar] Great global but little problem....
fuzzy logic 6445 Mar 12, 2004, 6:28 PM
Thread Re: [brakkar] Great global but little problem....
afinlr 6407 Mar 13, 2004, 4:47 AM
Thread Re: [afinlr] Great global but little problem....
brakkar 6415 Mar 15, 2004, 6:40 AM
Thread Re: [brakkar] Great global but little problem....
afinlr 6458 Mar 15, 2004, 6:53 AM
Post Re: [afinlr] Great global but little problem....
brakkar 6420 Mar 15, 2004, 7:00 AM