sub app_template
{
my $self = shift;
my $tmplname = shift;
my $t = $self->load_tmpl( $tmplname );
$t->param( 'current_user' => $self->session( 'username') );
$t->param( 'foo' => $self->config( 'foo') );
$t->param( 'bar' => $ENV{ 'bar'} );
return $t;
}
Then in any run mode, instead of calling load_tmpl (or whatever template
loading methodology you're using) I call
my $t = app_template( 'edit.tmpl' ); and add my run-mode specific variables from there. Hope that helps. Wojciech Pietron wrote:
Hello, sorry if someone has already mentioned that problem recently. Give me a link if it has been already discussed. There are some variables that I would like to have defined in all templatesI am going to use, ie. name of the user, url, sysdate etc.The question is: what is the simplest/best practice to maintain global template variables and not redefine them all after loading a new template? I am specially interested in CAP::AnyTemplate environment. Thank you in advance, Wojciech Pietron --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/suppressed/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: suppressed For additional commands, e-mail: suppressed
-- Steve Comrie LEAD SOFTWARE ARCHITECT | OCTANE T: 416.977.2525 F: 416.977.8481 355 ADELAIDE ST. W. SUITE 1B TORONTO, ONTARIO M5V 1S2 WWW.OCTANE.TO <http://www.octane.to>
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.