Gossamer Forum
Home : Products : DBMan SQL : Discussion :

multiple search_results.html same template set

Quote Reply
multiple search_results.html same template set
Does anyone know how to setup multiple search_results.html under the same template set and be able to call them in the url? i.e. search_results.html: url: ...do=search_results... and search_results2.html: url: ...do=search_results2...



thanks.
Quote Reply
Re: [useruseruser] multiple search_results.html same template set In reply to
search_results.html could (only) contain the following line:
Code:
<%dynamic_include($tmplname)%>
Where dynamic_include() would be the following template global:
Code:
'dynamic_include' => 'sub {
my $tpl = shift;
my $tags = GT::Template->tags;
return GT::Template->parse($tpl, $tags, { print => 0 });
}'

I use it myself to use a different template for all tables that I have. search_results.html looks like this:
Code:
<%set actionfile = generate_tmplname()%>
<%if actionfile and not details%>
<%dynamic_include($actionfile)%>
<%else%>
default search_results.html code
<%endif%>
Where generate_tmplname() is the following template global:
Code:
'generate_tmplname' => 'sub {
my $tags = GT::Template->tags;
my $tmplname = @_[0] || $tags->{do};
my $filename = $tags->{admin_root_path} . "/templates/" . $tags->{template} .
"/" . ( $tags->{q} || $tags->{db} ) . "/$tmplname" . ".html";
return -e $filename ? $filename : "";
}'

good luck, Jasper

http://www.bookings.org
Quote Reply
Re: [jaspercram] multiple search_results.html same template set In reply to
thank you... I'll give it a shot.