[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] list for TMPL_PATH


Hello everyone...

I was wondering if there was a way to specify a list of paths for the template provided by ->load_tmpl to search view the TMPL_PATH in ->new. E.g.

my $webapp = MyApp->new(
                        TMPL_PATH => [
                                      '../apptmpls/MyApp',
                                      '../apptmpls/.common-Superclass',
                                      '../apptmpls/.common-cgiapp',
                                      ],
                        PARAMS => {
                            POST_LOGIN_RM => 'customer_overview',
                            REQUIRE_LOGIN => 1,
                            TMPL_PARAMS => {
                                global_vars              => 1,
                                cache                    => 1,
                                die_on_bad_params        => 0,
                                output_file_name_comment => 1,
                            }
                        },
                        );

This seems most useful to me in terms of having a collection of template files that would be common to the superclass (or superclasses -- I have a fork in my superclasses for front-end user and back-end administrative classes).

If this is already implemented then please, point me at it. :-) Otherwise, here's a patch to CGI/Application.pm. (I'm currently implementing this for myself in my overloaded load_tmpl in my Superclass, but maybe it could be of more use to more people.

suppressed:~/tmp/cgi-app$ diff Application.pm Application.pm-new
358c358,363
<           push(@extra_params, path => [ $tmpl_path ]) unless $found;
---
>           push(@extra_params,
>               path => [
>                        ( ref($tmpl_path) eq 'ARRAY')
>                        ? @$tmpl_path
>                        : $tmpl_path
>                       ]) unless $found;

Cheers,
Richard


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


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.