Anthony Gardner wrote:

> At present, we have a standard set of templates but in the future, we 
> may need to deliver the same data but in a different style. This will be 
> set using a query string parameter.
> 
> As the $tt is created as a singleton one / process (mod_perl) and the 
> paths defined once, can someone tell me of a simple way round this.

Couldn't you just prefix a path to the template? So blah.tt2 calls 
$tt->process("default/blah.tt2", ...) whilst blah.tt2?style=fancy calls 
$tt->process("fancy/blah.tt2", ...) etc

> I've thought of just having a generic template entry point and then 
> calling the desired  starting template based on a simple IF ELSE  but 
> hopefully there's a TT configuration way.

I do something similar and actually find this template entry point 
system the best. Means you can change the system on the fly with a 
simple edit of templates rather than editing (and publishing in my case) 
modules and restarting apache. I have the file extension in the uri 
affecting the format of the page, so a url with blah.html will call 
blah.tt2 and return standrd html, blah.txt will call blah.tt2 and return 
text/plain format, and so on for blah.xml blah.wml or whatever.

:Travis


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to