[Catalyst] Displaying template files without adding new controller actions

Anthony Gladdish a.j.gladdish at newcastle.ac.uk
Mon Oct 11 14:50:31 GMT 2010


>-----Original Message-----
>From: Denny [mailto:2010 at denny.me]
>Sent: 11 October 2010 15:22
>To: The elegant MVC web framework
>Subject: Re: [Catalyst] Displaying template files without adding new controller
>actions
>
>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.

>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.

I want to add quite a few .tt2 pages to the app, in various directories.
I don't want to have to create a Controller action per added template page ( this is the only way I know of adding a web page to a Catalyst app ).
Every time I add a new page I'll have to add a new action to represent that page then restart the server. There must be a way to add as many template pages as required, and have a single Controller action display the web page if it's corresponding template exists, otherwise 404.

/app/example/one
/app/example/two
/app/example/three/a
/app/example/three/b

... each of these urls will map to a respective .tt2 template which the app will just forward to if it exists.

Suppose I had a 100 different ( fairly static content ) web pages - I really don't want to have to create an action for each.

Hope this helps.

Anthony


More information about the Catalyst mailing list