[Catalyst] :Template() Attribute
Bill Moseley
moseley at hank.org
Fri Jun 15 14:53:30 GMT 2007
On Fri, Jun 15, 2007 at 09:36:33AM -0400, Christopher H. Laco wrote:
> The concept is easy, add :Template() to a controller method. Catalyst
> automatically stoes that in the action->attributes. Then 'something' has
> to do stash->{template} ||= action->attributes->{Template}.
So you would use:
sub edit : Local : Template( 'edit.tt' ) {
my ( $self, $c ) = @_
...
}
instead of:
sub edit : Local {
my ( $self, $c ) = @_
$c->stash->{template} = 'edit.tt';
...
}
Or leaving it off and let View:TT create the template name
automatically from the action?
--
Bill Moseley
moseley at hank.org
More information about the Catalyst
mailing list