On Tue, Oct 23, 2001 at 01:40:03PM +0200, Jonas Liljegren wrote:
> I would like to change the generated code to this:
> $output .=  last_filter( $stash->get('maxlength') );

Yes, I was thinking along those lines for TT3, except that there would be
a print() method on the context in which things like default filters and 
object->template mapping can be done:

  $context->print('some plain text');
  $context->print($stash->get('maxlength'));

If the argument(s) to output() is an object then it can automatically
be mapped to the appropriate template and/or call a print() or present()
method on the object (like Template::View currently does).

My only concern is that this will add an extra method call for each piece
of text output, so I don't think it's appropriate as the default option.
Instead, I think the best solution is to leave GET as it is:

   [% GET foo %]  =>  $output .= $stash->get('foo')

and introduce a new directive PRINT which Does the Right Thing to print
the item appropriately by mapping to a template, or calling the object's 
print() method or whatever:

   [% PRINT foo %]  =>  $context->print($stash->get('foo'));

> We could have an configuration option for keeping the old behaviour
> and performance.

Yes, it should be possible to define if a variable by itself like
[% foo %] should be treated as [% GET foo %] (simple and fast) or 
[% PRINT foo %] (more magic, less speed).

A



Reply via email to