[Catalyst] Make the money format macro globally available.

Duncan Garland Duncan.Garland at motortrak.com
Wed Sep 22 10:47:29 GMT 2010


Works like a charm. Thanks.

-----Original Message-----
From: Larry Leszczynski [mailto:larryl at emailplus.org] 
Sent: 21 September 2010 18:05
To: The elegant MVC web framework; catalyst at lists.scsys.co.uk
Subject: Re: [Catalyst] Make the money format macro globally available.

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

_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list