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

Select one link via global

Quote Reply
Select one link via global
Hello,

i try to select one link with a global like this:

sub {

my $linkid = $IN->param('linkid');
my $link_db = $DB->table('Links');
my $sth = $link_db->select ({ID => $linkid, isValidated => 'Yes' });

my $output;
while (my $link = $sth->fetchrow_hashref){
$output .= Links::SiteHTML::display ('link', $link);
}

return $output;
}

and use
<%tipp_of_the_day($linkid,'43')%> in template but
get no result.
can anyone help me please?

Sör
Quote Reply
Re: [Sör] Select one link via global In reply to
Hi Sör,

This should work. I'm not sure the second parameter is for

Code:
sub {

my $linkid = shift;

my $link_db = $DB->table('Links');
my $sth = $link_db->select ({ID => $linkid, isValidated => 'Yes' });

my $output;
while (my $link = $sth->fetchrow_hashref){
$output .= Links::SiteHTML::display ('link', $link);
}

return $output;
}

Cheers,



Cheers,

Dat

Scripts installation and plugin creation
Plugins
Quote Reply
Re: [tandat] Select one link via global In reply to
Thanks Dat,

I use another way now. Instead of changing
the Id in templates, I change it now every
day in the subroutine Cool
Quote Reply
Re: [tandat] Select one link via global In reply to
..or;

Code:
sub {
my $link = $DB->table('Links')->select ({ID => $_[0] , isValidated => 'Yes' })->fetchrow_hashref;
return Links::SiteHTML::display ('link', $link);
}

..or if you want the tags like detailed_url, etc.. this would prob be better:

Code:
sub {
my $link = $DB->table('Links')->get( { ID => $_[0] });
return Links::SiteHTML::display ('link', $link);
}

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates