Gossamer Forum
Quote Reply
simple Global
I am trying to come up with a global to extrat a simple list of all links that has a URL that is a real domain (.com, .org... and such) and exculde the other links..

Has anyone done this before.
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] simple Global In reply to
Hi,

Not sure if this is what your trying to do (untested, so appologies if it doesn't work - still early morning with a little hangover ;))

Name the global: get_links_with_ext

Code:
sub {
my $cond = new GT::SQL::Condition;

foreach (qw/com org co.uk net/) {
$cond->add("%.$_/");
$cond->add("%.$_");
}
$cond-bool('OR');

my @links;
my $sth = $DB->table('Links')->select( $cond, { isValidated = "Yes" } ) || die $GT::SQL::error;

while (my $hit = $sth->fetchrow_hashref) {
push @links, $hit;
}

return { custom_links_loop => \@links };

}

..then call with:

Code:
<%get_links_with_ext%>
<ul>
<%loop custom_links_loop%>
<li><%Title%></li>
<%endloop%>
<ul>

Hope that helps.

Cheers

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

Last edited by:

Andy: Jun 8, 2008, 10:17 AM
Quote Reply
Re: [Andy] simple Global In reply to
Thanks

I am getting
Unable to compile 'get_links_with_ext': syntax error at (eval 6) line 5, near ") $cond" syntax error at (eval 6) line 7, at EOF "my" variable $GT::SQL::error can't be in a package at (eval 6) line 11, near "die $GT::SQL::error" Unmatched right curly bracket at (eval 6) line 19, at end of line

Any ideas?
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] simple Global In reply to
Whoops, my fault - was missing a { and also a ; - so thats prob why you were getting the error. Please try the modified version.

Cheers

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