Hey
I am trying to get some different database results to show up in 3 sections on my web page.
I use this sub
execute_search_results
my $opts = shift;
my $tags = GT::Template->tags;
my $home = $tags->{home};
my @opts = split ('&',$opts);
foreach (@opts) {
next if (!$_);
my ($n,$v) = split('=',$_);
if ($n) {
$home->{cgi}->{$n} = $v || $home->{cgi}->{$n};
}
}
local $home->{cfg} = $home->_load_cfg ($home->{cgi}->{db});
local $home->{db} = $home->{sql}->table ($home->{cgi}->{db});
my $results = $home->search_results;
foreach (keys % $results) { $tags->{$_} = $results->{$_}; }
return $results;
}On my page I call execute_search_results 3 times.
<%if hits%>
<%include sektionA.html%>
<%endif%>
<%execute_search_results("db=db&midem_b=ja")%>
<%if hits%>
<%include sektionB.html%>
<%endif%>
<%execute_search_results("db=db&midem_c=Ja")%>
<%if hits%>
<%include sektionC.html%>
<%endif%>
if I just call it 1 time it works perfect, but when I call execute_search_results 3 times it only shows the results from the first search.
Is it not possible to call the sub execute_search_results 3 times on the same page ?? or is there some thing I don't understand.
I hope somebody can help me. i have searched the forum but I haven't been able to find a solution.
Niels
I am trying to get some different database results to show up in 3 sections on my web page.
I use this sub
execute_search_results
Code:
sub { my $opts = shift;
my $tags = GT::Template->tags;
my $home = $tags->{home};
my @opts = split ('&',$opts);
foreach (@opts) {
next if (!$_);
my ($n,$v) = split('=',$_);
if ($n) {
$home->{cgi}->{$n} = $v || $home->{cgi}->{$n};
}
}
local $home->{cfg} = $home->_load_cfg ($home->{cgi}->{db});
local $home->{db} = $home->{sql}->table ($home->{cgi}->{db});
my $results = $home->search_results;
foreach (keys % $results) { $tags->{$_} = $results->{$_}; }
return $results;
}
Code:
<%execute_search_results("db=db&midem_a=Ja")%> <%if hits%>
<%include sektionA.html%>
<%endif%>
<%execute_search_results("db=db&midem_b=ja")%>
<%if hits%>
<%include sektionB.html%>
<%endif%>
<%execute_search_results("db=db&midem_c=Ja")%>
<%if hits%>
<%include sektionC.html%>
<%endif%>
if I just call it 1 time it works perfect, but when I call execute_search_results 3 times it only shows the results from the first search.
Is it not possible to call the sub execute_search_results 3 times on the same page ?? or is there some thing I don't understand.
I hope somebody can help me. i have searched the forum but I haven't been able to find a solution.
Niels