On Mon, 20 May 2002, Cory Trese wrote:

> List --
>
> I'm looking for a way for my CGI::Application to control all of it's
> HTML::Template calls from one place.  In the 'setup( )' (or
> 'cgiapp_init( )', 'cgiapp_prerun( )') I would like to be able to set my
> parameters (path, die_on_bad_params, path, etc) for the entire run (to end
> of this run-mode execution.)
>
> I've been trying all day to get this to work in some manner -- is anyone
> else trying or succeeding to do this?  Does some existing functionality
> exist to provide this type of control?

Cory,

I did this sort of thing in Cascade (
http://summersault.com/software/cascade ) by overriding the default
load_tmpl function. Here's how it looks:

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

        my $fq_tmpl_file = $self->tmpl_path() . $tmpl_file;

        require HTML::Template;
        # set up the templates with some defaults
        my $t = HTML::Template->new_file($fq_tmpl_file, @extra_params,
        # YOUR HASH OF DEFAULTS HERE
        );

        # call $t->param here to create your global tokens.

        return $t;
}



http://mark.stosberg.com/


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.vm.com/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to