[Catalyst] Loading template according to request path
J. Shirley
jshirley at gmail.com
Tue Aug 11 20:39:22 GMT 2009
On Tue, Aug 11, 2009 at 1:01 PM, Matt Whipple <matt at mattwhipple.com> wrote:
>
>> This is the default behavior for View::TT, as it says in the POD:
>>
>> If a stash item isn't defined, then it instead uses the stringification =
of
>> the action dispatched to (as defined by $c->action) in the above example,
>> this would be |message|, but because the default is to append '.tt', it
>> would load |root/message.tt <http://message.tt>|.
>>
>> Is that not what you wanted?
>>
>> -J
>>
>>
> That is matching according to action, I'm looking to match on path (witho=
ut
> having to create logically redundant complementary actions).
>
>
>
So, essentially, you have a separate path versus the action path, and want
it to default to the URI path and not the action Path?
Essentially:
sub end : Private ActionClass('RenderView') {
my ( $self, $c ) =3D @_;
$c->stash->{template} .=3D $c->req->uri->path . ".tt";
}
Is this right? This seems like a decent enough configuration idea to have
directly in Catalyst::View::TT, rather than always pick the action.
-J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090811/f278e=
b2c/attachment.htm
More information about the Catalyst
mailing list