On Thu, Jun 28, 2001 at 08:14:24PM +0200, Jonas Liljegren wrote:
> But then I thought that it would be better to specify the defaults
> just one time, as with plugins.  So I made a plugin of the filter
> (called Template::Plugin::HTML::FromText):
> 
> sub new {
>     my $class   = shift;
>     my $context = shift;
>     my $args    = ref $_[-1] eq 'HASH' ? pop(@_) : {};

You could do something like:

      $context->define_filter(HTMLFromText => \&filter);
or
      $context->define_filter(HTMLFromText => \&filter_factory, 1);

> The plugin filter can be used like this:
> 
>     [% USE fancy = HTML.FromText( email = 0 ) %]
> 
>     <p>[% product.description | $fancy.filter %]</p>

The plugin filter could then also be used like this:

[% USE HTML.FromText %]
<p>[% product.description | HTMLFromText( email = 0 ) %]</p>

Or something like that?

It's mentioned briefly under the FILTERS options:

  http://www.tt2.org/docs/default/Manual/Config.html#Plugins_and_Filters

HTH

A

-- 
Andy Wardley <[EMAIL PROTECTED]>   Signature regenerating.  Please remain seated.
     <[EMAIL PROTECTED]>   For a good time: http://www.kfs.org/~abw/


Reply via email to