On Mon, 2010-10-11 at 15:02 +0100, Anthony Gladdish wrote:
> I'd like to add various web pages to my Catalyst app without the need
> to modify controllers and restarting the server.
> Instead, I just want to add a Template::Toolkit .tt2 file on the file
> system and it get picked up automatically.

Something like this may help...
(in a theoretical MyApp/Controller/Thing.pm)

sub view : Chained( '/' ) : PathPart( 'view' ) : Args( 1 ) {
        my ( $self, $c, $template ) = @_;
        
        # [ stuff to set template variables in stash goes here ]
        
        $c->stash->{ template } = 'template-directory/'.$template.'.tt';
}

...so http://your.app/thing/view/foo will load the foo.tt template from
in template-directory.

That said, would you mind telling us a bit more about what you're
actually trying to achieve in your application?  There may be a better
or more standard way of doing it.

Regards,
Denny

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
List: Catalyst@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/

Reply via email to