Hello,
you should use the "eval" filter instead of "PROCESS", so there should be
the line:
my $mainTemplage = '[% empTemplate | eval %]';
greetings
gernot
-----Ursprüngliche Nachricht-----
Von: Travis Spencer
[mailto:travislspencer-PkbjNfxxIARBDgjK7y7TUQ@xxxxxxxxxxxxxxxx]
Gesendet: Freitag, 25. Juli 2003 08:03
An: templates-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@xxxxxxxxxxxxxxxx
Betreff: [Templates] Processing a template stored in a variable.
Hello,
I am trying to process a template that is stored in a TT variable. However,
I can't get it to work. Is it possible? I have included a little program to
demonstrate what I am trying to do:
#!/usr/bin/perl -w
use strict;
use Template;
my $t = new Template;
my $embeddedTemplate = q(
[% FOREACH i = [ 1 .. 10 ] %]
i = [% i %]
[% END %]
);
# Ideally, $mainTemplate would process the template that is stored in
# embTemplate, but, alas, it does not. :-(
my $mainTemplate = '[% PROCESS embTemplate %]';
$t->process(\$mainTemplate, { embTemplate => $embeddedTemplate, })
or die $t->error();
As is, this program results in this error:
file error - embTemplate: not found
I understand that it is looking for a template called embTemplate, so I
changed $mainTemplate to '[% PROCESS $embTemplate %]'. This, as you probably
already know, didn't work either.
Any suggestions would be much appreciated.
Regards,
Travis Spencer
Portland, OR USA
__o
_-\<,
(_)/(_)____
_______________________________________________
templates mailing list
templates-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@xxxxxxxxxxxxxxxx
http://lists.template-toolkit.org/mailman/listinfo/templates
|