Re: [Templates] PROCESS directive and variables
[prev]
[thread]
[next]
[Date index for 2004/11/13]
Hello, Andy Wardley!
Thank you for the reply!
> It's possible if you use an intermediate variable:
>
> [% file = 'tables/headers/'
> _ (param.body_tmpl || 'simple_body')
> _ '.html.tmpl' %]
>
> [% PROCESS $file %]
Yep. But I also think about the efficiency :) [% file = ... %] will create a
variable in $stash... But it won't be used out the the [% PROCESS %] scope. Is
it possible to create a local variable, say:
[% MY file = ... %]
:) I suppose I'd better use [% RAWPERL %] then...
>> As for me, I do not understand, why PROCESS is a bit special.
>
> In most cases, PROCESS, etc., are followed by a filename rather than a
> variable. It's optimised for that case, to avoid having to always quote
> filenames:
>
> [% PROCESS "header.txt" %]
:) I mean, I can invent the idea you've expressed, why PROCESS behaves like
this. But (it's my very IMHO) it breaks the overall TT ideology.
Yes, you are right. But usage of "header.txt" makes it easier to understand,
that it is a plain filename, and not $header{txt}. Using quotes adds some size
to the template, but not to compiled template, while the solution with a
temporary variable does.
Anyway, I just want to modify TT to suit my needs :) Can you help me with
grammar parser? I don't think it's impossible to force PROCESS to behave in some
other way :) Just a few words, about how grammar is build... and maybe I'll be
able to cope myself :))
Thanks a lot!
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates