I got confused while trying to use a MACRO for setting up a global
variable.

Example:

    [% BLOCK a %]
       [% global1 = "global1" %]
    [% END %]
    
    [% MACRO b BLOCK %]
      [% global2 = "global2" %]
    [% END %]
    
    [% MACRO c PROCESS c %]
    [% BLOCK c %]
       [% global3 = "global3" %]
    [% END %]
    
    [% PROCESS a; b; c; %]
    
    <br>A = [% global1 %]
    
    <br>B = [% global2 %]
    
    <br>C = [% global3 %]

result:

    A = global1
    B = 
    C = 

The documentation says that the block will be evaluated each time.
But it doesn't say if the block is INCLUDEd or PROCESSed.

But isn't C a bug?  [% c %] should be equivalent to [% PROCESS c %]
and should not localize the variables.




Why would I want to set global varaiables in a MACRO?  Eh... It looks
better... :-)


-- 
/ Jonas  -  http://jonas.liljegren.org/myself/en/index.html


Reply via email to