[Catalyst] Make the money format macro globally available.

Larry Leszczynski larryl at emailplus.org
Tue Sep 21 17:04:34 GMT 2010


Hi Duncan -

On Tue, 21 Sep 2010 17:52 +0100, "Duncan Garland"
<Duncan.Garland at motortrak.com> wrote:
> How do you make the money macro available in all templates?
> 
> [% USE money=format('%.2f') -%]
> 
> Presumably something goes in here:
> 
> __PACKAGE__->config(
>     TEMPLATE_EXTENSION => '.tt',
>     render_die => 1,
>     WRAPPER => 'wrapper.tt',
> );

You can put commonly used macros, formats, etc. in a file named e.g.
"pre_process_config.tt" in your main templates directory, then add
"PRE_PROCESS" to your config:


  __PACKAGE__->config(
      TEMPLATE_EXTENSION => '.tt',
      render_die => 1,
      WRAPPER => 'wrapper.tt',
      PRE_PROCESS => 'pre_process_config.tt'.
  );


HTH,
Larry



More information about the Catalyst mailing list