I've added the ability to a local copy of HTML::Template to allow 
HTML_TEMPLATE_ROOT to contain a ":" separated list of paths.  This is 
useful for our setup becuase we have a number of applications that are 
basically subclasses of other applications and we would like to share 
templates with the base application, yet make it easy to overload some 
templates.

How it works i I can configure the appliction with:

SetEnv HTML_TEMPLATE_ROOT /dir/app1/templates:/dir/app2/templates

ANd when accessing this app, HTML::Template first looks in 
/dir/app1/templates for the file in question.  If the file is not found, 
then it will look in /dir/app2/templates and so on.  This is similar to 
the "path" parameter to HTML::Template->new(), except it works at the 
configuration level.

The patch that provides this funcionality is quite simple:

--- Template.pm 2001/09/06 21:29:58     1.1.1.4
+++ Template.pm 2001/09/06 21:32:11     1.4
@@ -1431,8 +1431,10 @@

    # try pre-prending HTML_Template_Root
    if (exists($ENV{HTML_TEMPLATE_ROOT})) {
-    $filepath =  File::Spec->catfile($ENV{HTML_TEMPLATE_ROOT}, $filename);
-    return File::Spec->canonpath($filepath) if -e $filepath;
+    for my $path (split ':', $ENV{HTML_TEMPLATE_ROOT}) {
+      $filepath = File::Spec->catfile($path, $filename);
+      return File::Spec->canonpath($filepath) if -e $filepath;
+    }
    }

    # try "path" option list..

Anyway, in case this is useful to the community I thought I would send 
it along :).

Regards,
Michael Schout
GKG.NET, INC


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to