Gossamer Forum
Quote Reply
Custom global help
Hello

We are trying to pull a list of the root domain of each link listed in our database.. (over 25K links).

We have a global that returns a list of all links and we format the outcome using the ultraglobals Get_Domain_Name function...

The question is: how can we prevent the same domain from being listed more than. once
And can we prevent links from certain domains from being listed period.

basically we want a list of all true domains that have pages listed in our directory, but none of the free hosted links listed in it..

I hope that was clear.
Regards
KaTaBd

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

So you just want to get a list of unique domains?

i.e

www.domain.com
test.domain.com
www.test.com
foobar.com
somewone.freehost.com
test.sub.com

..and you just want :

domain.com
test.com
foobar.com
freehost.com
sub.com

..correct?

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
Quote Reply
Re: [Andy] Custom global help In reply to
Yes.. correct
Regards
KaTaBd

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

Try something like this:

Code:
sub {

my $tbl = $DB->table('Links');
$tbl->select_options("ORDER BY URL");
my $seen;

my $sth = $tbl->select( ['DISTINCT(URL)'], { isValidated => "Yes" } )|| die $GT::SQL::error;
my @urls;
while (my $url = $sth->fetchrow) {
my @split = split /\//, $url; # http:/ / domain.com /
my @split2 = split /\./, $split[2];
my $url_custom = $split2[$#split2-1] . '.' . $split2[$#split2];
if (!$seen->{$url_custom}) { push @urls, { URL => $url_custom }; $seen->{$url_custom} = l; }
}

return { url_loop => \@urls }
}

Call with:

Code:
<%global_name%>
<ul>
<%loop url_loop%>
<li><%URL%></li>
<%endloop%>
</ul>

Please note, this is TOTALLY untested ;)

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: Nov 21, 2008, 11:50 PM
Quote Reply
Re: [Andy] Custom global help In reply to
Thanks

I am getting:
syntax error at (eval 6) line 10, near "$#split ["
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory
Quote Reply
Re: [katabd] Custom global help In reply to
Whoops, were some errors - should have been:

my $url_custom = $split2[$#split2-1] . '.' . $split2[$#split2];

Please try the above.

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
Quote Reply
Re: [Andy] Custom global help In reply to
Thank you, I finally got it to work..
Now I can finish the small project
Regards
KaTaBd

Users plug In - Multi Search And Remote Search plug in - WebRing plug in - Muslims Directory