Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Re: [useruseruser] multiple search_results.html same template set

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
Subject Author Views Date
Thread multiple search_results.html same template set useruseruser 2675 Jan 17, 2003, 2:06 PM
Thread Re: [useruseruser] multiple search_results.html same template set
jaspercram 2593 Jan 20, 2003, 12:19 AM
Post Re: [jaspercram] multiple search_results.html same template set
useruseruser 2589 Jan 20, 2003, 9:29 AM