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

Global to return specific Cat/Subcat and links in it

Quote Reply
Global to return specific Cat/Subcat and links in it
I need a global that can be placed on home page and accepts the category id as an input, and returns back the immediate cat/subcat name only and the links in it:

Something like this:

which will return only a link to subcat

Nissan Pathfinder
- Nissan 1996 new car....
- Nissan Pathfinder 2001 with new tires...
- link3
- link4

CARS > Japaniese > Nissan > Nissan Pathfinder

thanks for your help

or how can I enhance this global by webmaster33 to display all links for the category (not the new ones only) and display also the immediate cat name:

Let me post the full global code, containing changes of the thread.

Global task: Display the latest the new 10 links only of a single category.
Global 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 10');
my $sth = $db_obj->select (['Links.*'], GT::SQL::Condition->new(
['CategoryID', 'IN', $all_ids],
['isValidated', '=', 'Yes', 'isNew', '=', 'Yes'])
my $output = qq~<br><hr>~;
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;

Global Usage:

1234 = category id of specific category

I also posted the code to Links SQL/Globals resources page.

It would be good idea to have more & more globals posted into the resource page above...

Laura, could you also post some globals to the Links SQL/Globals resources page?

Best regards,

Last edited by:

Mark2: Mar 6, 2006, 10:34 AM