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

What does these Globals do & how to call them on pages

Quote Reply
What does these Globals do & how to call them on pages

I have below Globals in my list & need to use few of them, but can't really distinguish one from another & don't recall how to use them :(.. Please help..

Global Name + Codes:
-----------------------------------------------------------------
cat_all_properties
Code:
sub {
my $ID = $IN->param('ID') || return '';
my $cat = $DB->table('Category')->select( { ID => $ID } )->fetchrow_hashref;
return $cat;
}
-----------------------------------------------------------------
cat_field
Code:
sub {
my $cols = $DB->table('Category')->cols;
my $return; foreach (sort{$cols->{$a}->{pos} <=> $cols->{$b}->{pos}} keys %$cols){ my $f = $cols->{$_};
my $n = $f->{form_display} || $_;
my $field = "Link_Add_Description" . $f;
$return->{$field} = qq|$n - Example, $f->{default}|;
} return $return;
}

-----------------------------------------------------------------
user_prop_on_any_page
Code:
sub {
my $User= $_[0];
my $Field= $_[1];
my $table = $DB->table('Users');
my $sth = $table->select( { Username => $User } );
my $Name;
while (my $hit = $sth->fetchrow_hashref) {
$Name = $hit->{$Field};
}
$Name ? return $Name : return "None";
}

-----------------------------------------------------------------
display_all_link_info
Code:
sub {
my $id=shift;
my $table = $DB->table('Links');
my $link = $table->select({ID=>$id})->fetchrow_hashref;
return {%$link};
}


-----------------------------------------------------------------
call_detail_url
Code:
sub {
my $id=shift;
my $table = $DB->table('Links');
my $link = $table->select({ID=>$id})->fetchrow_hashref;
my $detailed = $DB->table('Links')->detailed_url($id);
$link->{detailed_url} = "$CFG->{build_detail_url}/$detailed";
return {%$link};
}
-----------------------------------------------------------------

I normally name globals based on their usage, so the name of each global suggests that it does, however I can't figure out:
1: What type of output they produce.
2: How to call them.
3: What pages the output would work.

-----------------------------------------------------------------

P.S. As I am writing this post, I feel that it sounds more like something out of a video game, where there is a puzzle of old method/routine to solve before moving on to next step.


Please help....

Vishal
-------------------------------------------------------

Last edited by:

VishalT: Jan 6, 2020, 3:39 PM
Subject Author Views Date
Thread What does these Globals do & how to call them on pages VishalT 1185 Jan 6, 2020, 3:26 PM
Post Re: [VishalT] What does these Globals do & how to call them on pages
VishalT 1142 Jan 6, 2020, 8:09 PM
Thread Re: [VishalT] What does these Globals do & how to call them on pages
Andy 1140 Jan 7, 2020, 12:07 AM
Post Re: [Andy] What does these Globals do & how to call them on pages
VishalT 1135 Jan 7, 2020, 12:20 AM