Gossamer Forum
Quote Reply
Active Link ID global
Hello!

Is it possible to make a simple global which would show only active (validated) Link ID in ascending order, kind of:

Code:
<select name="Link_ID">
<option value="1">1</option>
<option value="2">2</option>
<option value="9">9</option>
<option value="25">25</option>
<option value="47">47</option>
<option value="66">66</option>
<option value="108">108</option>
</select>

Many thanks in advance.
Quote Reply
Re: [katakombe] Active Link ID global In reply to
Hi,

At its simplest:

get_active_links
Code:
sub {
my $Links = $DB->table("Links");
$Links->select_options("ORDER BY ID ASC");

my @loop;
my $sth = $Links->select( { isValidated => "Yes" } );
while (my $hit = $sth->fetchrow_hashref) {
push @loop, $hit;
}

return { active_links_loop => \@loop }
}

Call with:

Code:
<%get_active_links%>
<%loop active_links_loop%>
Got: <%ID%><br />
<%endloop%>

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Jun 29, 2013, 9:56 AM
Quote Reply
Re: [Andy] Active Link ID global In reply to
Hello and thank you Andy!

Here is the result:

Quote:
Unable to compile 'get_active_links': syntax error at (eval 23) line 6, near "$:Links" Global symbol "$sth" requires explicit package name at (eval 23) line 7. Global symbol "@loop" requires explicit package name at (eval 23) line 8. Global symbol "@loop" requires explicit package name at (eval 23) line 11. syntax error at (eval 23) line 12, near "} }"

Frown
Quote Reply
Re: [katakombe] Active Link ID global In reply to
Oops, please find the new version above. Thats what happens when you quickly write it in a couple of minutes Whistle

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Active Link ID global In reply to
SmileWinkw00t

Perfect! Many thanks Andy and have a nice evening!