For the record, I would use the template global generate_tmplname to generate the template name if it exists:
my $tags = GT::Template->tags;
my $tmplname = @_[0] || $tags->{do};
my $filename = $tags->{admin_root_path} . "/templates/" . $tags->{template} .
"/" . $tags->{db} . "/$tmplname" . ".html";
return -e $filename ? $filename : "";
}
In my template, I would like to use the subroutine like this:
<%if actionfile %>
<%include $actionfile%>
<%elsif%>
<%include default.html%>
<%endif%>
This would show a table specific template if it exists and a default template otherwise. Really useful!!!!!!
Jasper
BTW I am not sure how DBMan SQL specific the code above is. Sorry...
http://www.bookings.org
Code:
sub { my $tags = GT::Template->tags;
my $tmplname = @_[0] || $tags->{do};
my $filename = $tags->{admin_root_path} . "/templates/" . $tags->{template} .
"/" . $tags->{db} . "/$tmplname" . ".html";
return -e $filename ? $filename : "";
}
In my template, I would like to use the subroutine like this:
Code:
<%set actionfile = generate_tmplname('actionlist')%> <%if actionfile %>
<%include $actionfile%>
<%elsif%>
<%include default.html%>
<%endif%>
This would show a table specific template if it exists and a default template otherwise. Really useful!!!!!!
Jasper
BTW I am not sure how DBMan SQL specific the code above is. Sorry...
http://www.bookings.org