> So I have one template containing my menu bar, and several
> other templates, one for each screen, each <TMPL_INCLUDING>
> my "menu_bar.tmpl".
>
> So far, so good. But what is the best practice to avoid writing
> the code for populating <TMPL_VARS> in "menu_bar.tmpl"
> in every run mode?
>
That's pretty much what I do. The difference is that I have
pretty much one main template for the site or specific section
of the site. I really haven't been including templates from
within other templates... So, for a menu bar, I would maybe
have a get_menu_bar function which would return the text for
the menu bar and then put that in the general template.
The main template would be something like:
<html>
...
<table>
<tr>
<td><TMPL_VAR NAME=MENU></td>
</tr>
<tr>
<td><TMPL_VAR NAME=CONTENT></td>
</tr>
</table>
...
I would then have print_main function:
sub print_main
{
my $self = shift;
my ($params) = @_;
my $menu = $self->get_menu_bar();
$tmpl_obj->param("MENU", $menu);
for (keys %{ $params })
{
$tmpl_obj->param($_, $params->{$_});
}
return $tmpl_obj->output();
}
then in each screen for this section, at the end I would
call
$self->print_main({CONTENT=>$content});
That's what I'm doing. I think it's a situation where both ways
are pretty much equal, so go with what feels more comfortable to
you.
Nate
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.