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

global - list of variables

Quote Reply
global - list of variables
Is there a way that global will get list of variables and will return the ID that have one of the variable.
Something like <%cat_new_link($ID, aaa,zzz,xxx,ccc,vvv)%>
And in the Global something like
'Address' => Like => "%aaa%"
'Address' => Like => "%zzz %"
'Address' => Like => "%ccc %"
Quote Reply
Re: [nir] global - list of variables In reply to
Hi,

Do you mean something like this:

get_results_like
Code:
sub {

my $ID = $_[0];
my $option1 = $_[1];
my $option2 = $_[2];
my $option3 = $_[3];
my $option4 = $_[4];
my $option5 = $_[5];

my $cond = new GT::SQL::Condition;
if ($option1) {
$cond->add("Address","LIKE","%$option1%");
}
if ($option2) {
$cond->add("Address","LIKE","%$option2%");
}
if ($option3) {
$cond->add("Address","LIKE","%$option3%");
}
if ($option4) {
$cond->add("Address","LIKE","%$option4%");
}
if ($option5) {
$cond->add("Address","LIKE","%$option5%");
}
$cond->bool('OR');

my $sth = $DB->table('CatLinks','Links')->select ( { 'CatLinks.CategoryID' => $ID }, $cond ) || die $GT::SQL::error;
my @loop;

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

return { result_link_loop => \@loop };
}

Then call with:

Code:
<%get_results_like($ID,'something','something else','something else','something else','something else')%>
<%if result_link_loop.length%>
<%loop result_link_loop%>
<%include link.html%>
<%endloop%>
<%endif%>

Untested, but should work.

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] global - list of variables In reply to
Thanks,
If I have 10 variables up to 15 do you think that this is the right way do to this.
Quote Reply
Re: [nir] global - list of variables In reply to
Hi,

Well, test it with just 5 variables to start with - and then you can just tweak the global so it works with more (if it does what you want =))

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] global - list of variables In reply to
Yes, this is what I want. Just want to know if its O.K. to use many condition n global.
In this global can it work that I send more than one category ID?
Thanks
Quote Reply
Re: [nir] global - list of variables In reply to
Hi,

Yeah, 10-15 conditions shouldn't be a problem at all.

Quote:
In this global can it work that I send more than one category ID?

Nah, this global will only work with one category ID (could be tweaked to work with more than one ID, but I don't have time currently to do that =))

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