FAQ

On Tue, Oct 12, 2010 at 1:27 PM, Fernan Aguero wrote:
On Tue, Oct 12, 2010 at 12:47 PM, Anthony Gladdish
wrote:
Thanks for your feedback Denny, Ben and Stuart ? good food for thought!

I think some sort of handling logic in Root?s default action to test for the
existence of template and error or 404 if it doesn?t ? is the way forward.

Many thanks,

Anthony
Indeed. We had the same itch, and in our app, what we did is the following:

i) uniquely name all templates that need some processing by the
templating engine (e.g. to apply headers or footers) but otherwise no
processing by a controller. In our case all templates are named as
*.tts files.
Errate: of course I meant 'all these templates' ... the rest of the
templates (those referred to by controllers) are of course named '.tt'
or '.tt2'

Cheers,
Then in the Root.pm controller we have something like:
sub default : Private {
? my ( $self, $c ) = @_;

? my $path = $c->request->path;
? my $root = $c->config->{root};

? if ( -e "$root/src/$path.tts" ) {
? ? $c->stash->{template} = "$path.tts";
? ?...
? ...

--
fernan

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 9 of 9 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedOct 11, '10 at 2:02p
activeOct 12, '10 at 4:29p
posts9
users5
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase