[Catalyst] Catalyst & Bricolage Integration
Simon Wilcox
simonw at digitalcraftsmen.net
Wed Nov 22 00:13:16 GMT 2006
On Tue, 21 Nov 2006, Tobias Kremer wrote:
> > Nope, I just created a directory called test, created a test.html in it
> > and called it:
> > And catalyst wraps the rest. You can do subrequests within the TT
> > templates to fill in bits dynamically.
>
> Unfortunately this voodoo didn't work for me :( My sandbox Cat app just
> displays the default template.
So we have a regex match defined in an appendix package[1]
sub static : Regex('(\S*.html)$') {
my ( $self, $c ) = @_;
my $uri = $c->req->snippets->[0] ;
if (-f "root/$uri") {
$c->stash->{ template } = $uri ;
} else {
# not found
$c->res->status(404);
}
}
This matches anything ending .html and passes it off to View::TT for
rendering. Works a treat.
I think DaveH gets the props for that piece of code.
HTH,
Simon Wilcox
[1] withered and not really used but turns out to be quite important if
abused :-)
--
Digital Craftsmen Ltd
Exmouth House, 3 Pine Street, London. EC1R 0JH
t 020 7183 1410 f 020 7099 5140 m 07951 758698
w http://www.digitalcraftsmen.net/
More information about the Catalyst
mailing list