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

Products: Gossamer Links: Development, Plugins and Globals: FatherID with Global: Edit Log

Here is the list of edits for this post
FatherID with Global
 
How do I get the FatherID instead of ID with this global?


Code:
sub {
# return random related links
my (@links,$sth,$link);
my $tags = shift;
my ($cat_id) = each %{$DB->table('Links')->get_categories($tags->{ID})};
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY RAND()","LIMIT 6");
my $sth = $link_db->select ( { CategoryID => $cat_id }, {isValidated => 'Yes'});
while (my $link = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags('link', $link);
unless ($link->{ID} == $tags->{ID}){
push@links, $link;
}
}
return {relatedlnks=>\@links};
}


Code:
sub {
# return random related links
my (@links,$sth,$link);
my $tags = shift;
my ($cat_id) = each %{$DB->table('Links')->get_categories($tags->{ID})};
my $link_db = $DB->table('Links','CatLinks','Category');
$link_db->select_options ("ORDER BY RAND()","LIMIT 6");
my $sth = $link_db->select ( { FatherID => $cat_id }, {isValidated => 'Yes'});
while (my $link = $sth->fetchrow_hashref) {
$link = Links::SiteHTML::tags('link', $link);
unless ($link->{ID} == $tags->{ID}){
push@links, $link;
}
}
return {relatedlnks=>\@links};
}

~ ERASER


Free JavaScripts @ Insight Eye

Last edited by:

Eraser: Aug 2, 2008, 6:32 AM

Edit Log: