Pardon me if this question is stupid. I couldn't find an
answer on the mailing list.

I'm trying to build a multiple choice questionaire framework
with Template.

This is what I'd like to do

Template:
    [% params= {} %]

    [% BLOCK QUESTION -%]
       [% params.import( values ) %]
       [% import( params ) %]
       [% content  %]
    [% END -%]

    [% BLOCK ANSWER -%]
       [% import( params ) %]
       [% content %]
    [% END -%]

Instance:
    [% WRAPPER QUESTION
        values= { V1= 2, V2= 2 }  -%]
    What is  [% V1 %] + [% V2 %]?
    [%- END %]

    [% WRAPPER RIGHTANSWER -%]
    => [% V1 + V2 %].
    [%- END %]

Desired Output:
    What is 2 + 2?
    => 4.

Actual Output:
    What is  + ?
    => 0.

However, I note that if I put
    [% WRAPPER RIGHTANSWER -%]
       [% import( params ) %]
        [% V1 + V2 %]
    [%- END %]

Then I get '=>4.', but this doesn't work for the QUESTION section?

I think that the BLOCKS are not evaluated lazily. Can I force this?

Help? Thanks


Andy
--
Andy Adler,     Assistant Professor, School of Information Technology and
Engineering, University of Ottawa, 1(613)562-5800x6218, [EMAIL PROTECTED]




_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to