[Catalyst] HOWTO reference config settings from template

Jeff Chimene jchimene at gmail.com
Thu Apr 12 16:35:44 GMT 2007


Peter Karman wrote:
>
>
> Jeff Chimene scribbled on 4/12/07 9:29 AM:
>> Hi,
>>
>> I'm not sure if this is a Catalyst question -
>>
>> How do I reference __PACKAGE__config settings from a Template Toolkit 
>> template?
>>
>> I'd like to use the config tool to set values outside the stash.
>>
>
>
> [% c.config.yourconfigkeyhere %]
>
Hi Peter,

Thank-you for the prompt response.

I tried that as one of my first attempts. No joy. I've also tried:
[%
    USE Dumper;
    dump_html(Catalyst);
%]

and I don't see the TT2 configuration settings. When I try the similar 
experiment in the perl module, & dump __PACKAGE__->config, the TT2 
configuration settings are displayed.

Here is the relevant perl code from the P::V I should be able to display 
any of these variables, right?
__PACKAGE__->config({
                     CATALYST_VAR => 'Catalyst',
                     INCLUDE_PATH => [
                                      fori->path_to( 'root', 'src' ),
                                      fori->path_to( 'root', 'lib' )
                                     ],
                     PRE_PROCESS  => 'config/main',
                     WRAPPER      => 'site/wrapper',
                     ERROR        => 'error.tt2',
                     TIMER        => 0,
                     FRAMES       => 1,
                    });

Here are the TT2 references I've tried. I use ERROR here on the 
assumption (probably incorrect) that I cannot stick a "new" value into 
the config list.
Frames = [% Catalyst.config.error %]
Frames = [% c.config.error %]
Frames = [% Catalyst.config.ERROR %]
Frames = [% c.config.error %]

Cheers,
jec






More information about the Catalyst mailing list