[Catalyst] HOWTO reference config settings from template

Jeff Chimene jchimene at gmail.com
Fri Apr 13 21:02:28 GMT 2007


Hi,

Thanks for the reply.

I see two ways to obtain TT2 configuration values in the TT2 template:

Bill Moseley wrote:
 >
 > [%
 >     USE foo = Class( 'Whatever::View::TT' );
 >     USE Dumper; Dumper.dump(foo.config ) | stderr;
 > %]

and

Robert 'phaylon' Sedlacek wrote:
 >
 > The merged configuration will be usually (if not implemented 
otherwise) in
 > the controller instance directly. So the best way might be
 >
 >   package MyApp::View::TT
 >   ...
 >   sub the_config_you_want {
 >       my ($self) = @_;
 >       return $self->{the_config_you_want};
 >   }
 >
 > and then in the template
 >
 >   [% c.view('TT').the_config_you_want %]

Cheers,
jec



More information about the Catalyst mailing list