I don't think that splitting on ':' in load_tmpl is the best way to go about this.. however I do think that HTML::Template should split on ':'. This would make it easy to add multiple paths using the $ENV{HTML_TEMPLATE_ROOT} (which could be set in the httpd.conf).

I do however think that C::A's TMPL_path/tmpl_path() should be able to handle correctly what H::T's 'path' parameter expects...

any other ideas, suggestions? If nobody says anything else, I'll just get a patch together...


Bill Catlan wrote:
I needed the same thing ... haven't submitted a patch
yet ... below splits string paths separated by ':' :

Bill

From C::A 3.22, as modified:

sub load_tmpl {
        my $self = shift;
        my ($tmpl_file, @extra_params) = @_;

# add tmpl_path to path array of one is set,
otherwise add a path arg
if (my $tmpl_path = $self->tmpl_path) {
my $found = 0;
for( my $x = 0; $x < @extra_params; $x
+= 2 ) {
if ($extra_params[$x] eq
'path' and ref $extra_params[$x+1] and
ref $extra_params[$x+1] eq
'ARRAY') {
unshift
@{$extra_params[$x+1]}, $tmpl_path;
$found = 1;
last;
}
}
my @tmpl_paths = split( /:/, $tmpl_path );
push(@extra_params, path => [EMAIL PROTECTED] )
unless $found;
}


        require HTML::Template;
        my $t = HTML::Template->new_file($tmpl_file,
@extra_params);

        return $t;
}

----

--- Michael Peters <[EMAIL PROTECTED]> wrote:


hello all,

I'm trying to find a way to pass multiple search
paths either to TMPL_PATH or tmpl_path in my base class and then
have all my child classes be able to access it. The problem is that
C::A will wrap whatever value is in 'tmpl_path' in [] thus creating
an array of arrays if it's an array. Any work arounds? if not I guess
I'll make a patch...



-- Michael Peters Developer Plus Three, LP




---------------------------------------------------------------------

Web Archive:


http://www.mail-archive.com/[EMAIL PROTECTED]/

http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]






-- Michael Peters Developer Plus Three, LP


--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to