[Catalyst] HOWTO reference config settings from template
Jeff Chimene
jchimene at gmail.com
Fri Apr 13 00:18:06 GMT 2007
Jason Kohles wrote:
> On Apr 12, 2007, at 1:01 PM, Jeff Chimene wrote:
>
>>
>> The config is called in the View package (fori::View::Menu) I was
>> hoping to set TT2 values /per package/ via the config as created by
>> the TT2 helper. It looks like (after DEBUG => 'all') that TT2 only
>> references the stash when it resolves variables.
>>
> What is the problem you are trying to solve? Changing the template
> processor configuration from within a template that it is currently
> processing doesn't seem wise to me.
>
>
> That being said, the reason that only the stash variables are
> accessible is because they are all that are provided to TT by default...
>
> package MyApp::View::TT;
>
> sub template_vars {
> my ( $self, $c ) = @_;
>
> my %vars = $self->SUPER::template_vars( $c );
>
> $vars{ 'ttconfig' } = $self->config;
>
> return %vars;
> }
>
Hi Jason,
Thanks for the reply. The problem I'm trying to solve is referencing
(reading) config settings from a template. I'd like to tell one or more
templates that sometimes they will use frames & sometimes not
(debugging). I blithely assumed this would be an appropriate use of
configuration variables. I was wrong. I'll use the stash for now.
Cheers,
jec
More information about the Catalyst
mailing list