Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [Mark2] display new links of a specific category?

Quote Reply
Re: [Mark2] display new links of a specific category? In reply to
Code:
sub {
my $cat_id = shift;
my $new_nr_limit = shift || 10; # Default is 10
($cat_id && $cat_id =~ /^\d+$/)
|| return "Invalid category ID passed to new_links_of_category global: $cat_id\n";
my $all_ids = $DB->table('Category')->children($cat_id);
push @$all_ids, $cat_id;
my $db_obj = $DB->table('Links','CatLinks','Category');
$db_obj->select_options ('ORDER BY Add_Date DESC Limit $new_nr_limit');
my $sth = $db_obj->select (['Links.*'],
GT::SQL::Condition->new(
['CategoryID', 'IN', $all_ids],
['isValidated', '=', 'Yes',
'isNew', '=', 'Yes']
)
);
my $output;
while (my $link = $sth->fetchrow_hashref) {
$link->{'category_url'} = $CFG->{build_root_url}."/".$link->{'Full_Name'}."/";
$link->{'detailed_url'} = "$CFG->{build_detail_url}/$link->{'ID'}$CFG->{build_extension}";
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}

Quote:
1 - How about if I want to display only the name of the cat/subcat for the specific cat/subcat that is being displayed.
Just change the link.html template file and use the correct field name...


Quote:
2 - and what about if I want to display all the links instead of just the new ones.
I highlighted the affecting part with red just remove them and you are fine.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Subject Author Views Date
Thread display new links of a specific category? antoined 14985 Oct 9, 2004, 9:17 AM
Thread Re: [antoined] display new links of a specific category?
antoined 14273 Oct 12, 2004, 10:43 AM
Thread Re: [antoined] display new links of a specific category?
Andy 14388 Oct 12, 2004, 12:08 PM
Thread Re: [Andy] display new links of a specific category?
antoined 14297 Oct 12, 2004, 2:10 PM
Thread Re: [antoined] display new links of a specific category?
Andy 14539 Oct 13, 2004, 1:29 AM
Thread Re: [Andy] display new links of a specific category?
VishalT 14318 Oct 13, 2004, 9:34 AM
Post Re: [NeedScripts.Com] display new links of a specific category?
Andy 14213 Oct 13, 2004, 9:43 AM
Thread Re: [NeedScripts.Com] display new links of a specific category?
afinlr 14415 Oct 13, 2004, 5:20 PM
Thread Re: [afinlr] display new links of a specific category?
nir 14433 Oct 14, 2004, 2:21 AM
Post Re: [nir] display new links of a specific category?
afinlr 14217 Oct 14, 2004, 11:35 AM
Thread Re: [afinlr] display new links of a specific category?
nir 14355 Nov 1, 2004, 3:31 AM
Thread Re: [nir] display new links of a specific category?
Andy 14366 Nov 1, 2004, 3:49 AM
Thread Re: [Andy] display new links of a specific category?
nir 14226 Nov 1, 2004, 4:56 AM
Thread Re: [nir] display new links of a specific category?
Andy 14202 Nov 1, 2004, 5:17 AM
Thread Re: [Andy] display new links of a specific category?
nir 14147 Nov 1, 2004, 5:30 AM
Thread Re: [nir] display new links of a specific category?
Andy 14290 Nov 1, 2004, 5:51 AM
Thread Re: [Andy] display new links of a specific category?
nir 14108 Nov 1, 2004, 6:21 AM
Post Re: [nir] display new links of a specific category?
Andy 14147 Nov 1, 2004, 6:29 AM
Post Re: [nir] display new links of a specific category?
afinlr 14169 Nov 1, 2004, 6:20 AM
Post Re: [afinlr] display new links of a specific category?
VishalT 14161 Nov 1, 2004, 3:52 AM
Thread Re: [afinlr] display new links of a specific category?
webmaster33 14099 Jul 29, 2005, 5:14 PM
Thread Re: [webmaster33] display new links of a specific category?
afinlr 13991 Jul 30, 2005, 2:22 PM
Thread Re: [afinlr] display new links of a specific category?
webmaster33 14142 Jul 31, 2005, 11:46 AM
Thread Re: [webmaster33] display new links of a specific category?
pugdog 14071 Aug 1, 2005, 9:27 AM
Post Re: [pugdog] display new links of a specific category?
webmaster33 14021 Aug 1, 2005, 9:39 AM
Thread Re: [webmaster33] display new links of a specific category?
Teambldr 12285 Aug 2, 2005, 11:49 PM
Post Re: [Teambldr] display new links of a specific category?
webmaster33 12147 Aug 3, 2005, 1:13 AM
Thread Re: [Teambldr] display new links of a specific category?
webmaster33 12508 Aug 3, 2005, 1:34 AM
Thread Re: [webmaster33] display new links of a specific category?
Teambldr 12815 Aug 3, 2005, 10:40 AM
Post Re: [Teambldr] display new links of a specific category?
webmaster33 12195 Aug 3, 2005, 11:39 AM
Thread Re: [webmaster33] display new links of a specific category?
ManuGermany 12187 Aug 5, 2005, 3:20 AM
Thread Re: [ManuGermany] display new links of a specific category?
webmaster33 12260 Aug 5, 2005, 5:48 AM
Thread Re: [webmaster33] display new links of a specific category?
ManuGermany 12196 Aug 5, 2005, 8:47 AM
Thread Re: [ManuGermany] display new links of a specific category?
webmaster33 12231 Aug 5, 2005, 10:06 AM
Thread Re: [webmaster33] display new links of a specific category?
ManuGermany 12321 Aug 5, 2005, 10:14 AM
Post Re: [ManuGermany] display new links of a specific category?
webmaster33 12152 Aug 5, 2005, 11:24 AM
Thread Re: [ManuGermany] display new links of a specific category?
webmaster33 12219 Aug 5, 2005, 11:47 AM
Thread Re: [webmaster33] display new links of a specific category?
ManuGermany 12171 Aug 6, 2005, 4:51 AM
Post Re: [ManuGermany] display new links of a specific category?
nir 12142 Aug 15, 2005, 5:12 AM
Post Re: [ManuGermany] display new links of a specific category?
ManuGermany 11956 Dec 14, 2006, 4:03 AM
Thread Re: [webmaster33] display new links of a specific category?
Mark2 12058 Mar 6, 2006, 8:15 AM
Thread Re: [Mark2] display new links of a specific category?
webmaster33 12120 Mar 6, 2006, 10:54 AM
Thread Re: [webmaster33] display new links of a specific category?
Mark2 11918 Mar 6, 2006, 12:32 PM
Thread Re: [Mark2] display new links of a specific category?
webmaster33 11958 Mar 6, 2006, 1:01 PM
Thread Re: [webmaster33] display new links of a specific category?
Mark2 12037 Mar 6, 2006, 2:22 PM
Thread Re: [Mark2] display new links of a specific category?
webmaster33 12070 Mar 6, 2006, 3:34 PM
Post Re: [webmaster33] display new links of a specific category?
Mark2 11973 Mar 7, 2006, 7:33 AM
Post Re: [Mark2] display new links of a specific category?
Mark2 11956 Mar 7, 2006, 10:45 AM