Hi Ashley,

you can do this via your template config.

my $template = Template->new({
        INCLUDE_PATH => [ '/home/usr/html',
                          '/usr/local/html' ],
    });

Put the users' directory first, followed by the default directory. TT will search the directories in order giving the effect you are after.

cheers,

J


apv wrote:
I am working on an application where I want the user to be able to supply their own templates which will take precedence over the default ones.

It seems like there might be a way to do this in the include path ordering or something but all I can up with is something like this:

[% TRY %]
[% INCLUDE user_dir/template_xyz %]
[% CATCH %]
[% INCLUDE default_dir/template_xyz %]
[% END %]

That seems fine for a single case but I want the user to be able to override pretty much every template (without having to do so; meaning the defaults are largely going to remain and thus we can't simply choose one entire set or the other).

Any great ideas?

-Ashley


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



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

Reply via email to