Hi
I am guessing you are assembling a string from repeated calls to process one or 
more templates, cherry-picking sections from each?

Maybe something like this:

( note that $page is passed in by reference )

#=========================================
#!/usr/bin/perl

use Template;

my $template = <<'END';
[% IF set_first_part  %]
first_part_of_form
[% ELSIF set_second_part %]
second_part_of_form
[% END %]
END

my $tt = Template->new();
my $page;
$tt->process( \$template, { set_first_part  => 1,}, \$page ) or print $tt->error, 
"\n";
$page .= "\n--- half way ---\n";
$tt->process( \$template, { set_second_part => 1,}, \$page ) or print $tt->error, 
"\n";
print $page;
#=========================================

yields:

first_part_of_form


--- half way ---

second_part_of_form


#==========


If not, then maybe some more info would help..

Regards,

David



On 26/02/16 18:31, Norris, Joseph wrote:

Hello all,

Did quite a bit of work with TT some years ago – just coming into a project 
where it will be ideal.

Here is my issue:

I am converting a bunch of html embedded scripts into TT based scripts and I have a situation where ( for lack of better words ) I must “append” parts of forms to other parts – so I have a the following mockup

first_part_of_form

   on condtion – keep first_part_of_form and append

        second_part_of_form

I have tried setting if conditions in my perl script and do the process to a 
variable but when I do the following:

$form->{set_first_part} = true

  and then in the form I have [% IF set_first_part == ‘true’ %]

                                  first_part_of_form

          [% END %]

And then set it to false – as expected I do not get the first_part_of_form - I need to keep this intact and then append second_part_of_form

Maybe I am over-thinking this but I would like to get to as close as I can to a 
single html file to handle what I am doing.

I would appreciate any suggestion of how I might go about this – maybe there is 
something in TT that I have not even considered

Thanks for your help.

*Joseph Norris *social-icons_green-linkedin.png <https://www.linkedin.com/company/pacific-metrics>**social-icons_green-twitter.png <https://twitter.com/PacificMetrics>

**Software Applications Engineer

*PACIFIC METRICS*****

1 Lower Ragsdale Dr #150*| *Monterey, CA 93940

*T*_623-203-8866_

*E*jnor...@pacificmetrics.com <mailto:jnor...@pacificmetrics.com>*| 
W*www.pacificmetrics.com <http://www.pacificmetrics.com/>__

*email-sig-logo.jpg*



_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates


_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to