[Catalyst] Loading template according to request path
fREW Schmidt
frioux at gmail.com
Tue Aug 11 20:14:56 GMT 2009
On Tue, Aug 11, 2009 at 3:01 PM, Matt Whipple <matt at mattwhipple.com> wrote:
> J. Shirley wrote:
>
>> On Tue, Aug 11, 2009 at 12:09 PM, Matt Whipple <matt at mattwhipple.com<mai=
lto:
>> matt at mattwhipple.com>> wrote:
>>
>> Is there a presently existing mechanism which flexibly allows for
>> template selection according to the request URI? For instance a
>> request to www.myapp.com/somepage <http://www.myapp.com/somepage>
>> would set something like stash(template =3D> 'somepage.tt
>> <http://somepage.tt>') if the file exists and continue to be
>> processed by the appropriate or default action.
>>
>> I wrote something which does this which I'm about to spend some
>> time cleaning up and optimizing but don't want to be reinventing
>> any wheels (especially likely smoother ones).
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk <mailto:Catalyst at lists.scsys.co.uk>
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>>
>>
>>
>>
>> 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).
>
Well, you could be clever and do some kind of thing in an auto to do
that....
-- =
fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090811/c4751=
435/attachment.htm
More information about the Catalyst
mailing list