Hello.

Following the guidlines I set the TEMPLATE_OPTIONS by calling tt_config from my cgiapp_init - inside my main/base module. That way I can set the config for the whole site which is spread in several modules that contain runmodes.

But I run into a problem. I need a way to change (only part) of the TEMPLATE_OPTIONS in several runmodes. To be specific I use WRAPPER for most of the site - except in couple of runmodes.

I see no way to change the options once they are set. Only way is to replace them (as a whole).
Which means I would need to do something like :

sub cgiapp_init {
        my $self = shift;

        my $tt_options = {
                WRAPPER => 'whatever.tmpl',
                ...,
                ...
        }

        $self->param('tt_options' => $tt_options); # store for latter ussage
        $self->tt_config(TEMPLATE_OPTIONS => $tt_options);
}

=== Then when I need to change some of them somewhere ===

        my $tt_options = $self->param('tt_options');
        undef $tt_options->{WRAPPER};
        $self->tt_config(TEMPLATE_OPTIONS => $tt_options);


Am I missing something?


BTW. Cees can you (or anyone else) explain how does tt_config set the options?
I'm lost on how does this code/line works:

$tt_config->{TEMPLATE_OPTIONS} = delete $props->{TEMPLATE_OPTIONS};

Actualy I get it ... Nice! ... It appears to be a shorter version for:

$tt_config->{TEMPLATE_OPTIONS} = $props->{TEMPLATE_OPTIONS};
undef($props->{TEMPLATE_OPTIONS});

Anyway I would need something like this instead:

foreach(keys %{$props->{TEMPLATE_OPTIONS}}){
        $tt_config->{TEMPLATE_OPTIONS}->{$_} = $props->{TEMPLATE_OPTIONS}->{$_};
}
undef($props->{TEMPLATE_OPTIONS});

Would you accept a patch? Where/how do I submit? (it would be my first) ;D


Best regards,
--
Aleksandar Petrović - Alex


---------------------------------------------------------------------
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