What I'd like to do is get wonderful levels of template reuse. Because we'll have different instances of the same modules, I'd like to be able to point the module to a directory for templates, and have every PROCESS-like calls that start at the directory, and 'fall' upward to the template root (we don't allow absolute paths). Thus we can define a directory and store the various templates for the default tool there, and create subdirs of more specific applications of the tool. Any case where the specific application doesn't have a template defined will default to the more generic version.
OpenInteract does something similar to this -- there are the default templates shipped with a package and the customized templates installed to a website. The directory structure looks like this:
Default templates shipped with foo-0.02 $SITE/pkg/foo-0.02/template/mytemplate.tmpl
Customized template for any version of package 'foo': $SITE/template/foo/mytemplate.tmpl
So when you call:
[% PROCESS foo::mytemplate %]
(I overrode Template::Context to allow the package::template syntax.)
It first checks for a customized template, then it checks for the default template. You do this by overriding Template::Provider and telling your Template object to use your Provider before the built-in one. It's been a litle while since I did this, but it's not that difficult, and you can look at OpenInteract and Slashcode for examples. But most of the logic behind pulling up a specific template is in a separate object that knows what an OpenInteract website is, what a package is, etc.
Hope this makes some sense.
Chris
-- Chris Winters ([EMAIL PROTECTED]) Building enterprise-capable snack solutions since 1988.
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
