I have a template file1.tt that I would like to INCLUDE in a higher level template. But I would like to override the default values. Looks like overriding boolean values which have a default of 1 does not work correctly. I tried this in two ways: by using another 'calling' template and also by using a hash to define these values and passing that to the template, neither of which gave the result I desired. Below are the examples and outputs.
 
[%# ---------- file1.tt ----------%]
[% DEFAULT 
      MY_BOOL_D0 = 0,
      MY_BOOL_D1 = 1,
      MY_INT_D10   = 10 %]
 
Print Values:
MY_BOOL_D0 = $MY_BOOL_D0
MY_BOOL_D1 = $MY_BOOL_D1
MY_BOOL_D10 = $MY_BOOL_D10
[%# ---- End of file1.tt --------- %]
 
If I run this template by itself , then I get the following lines
MY_BOOL_D0 = 0
MY_BOOL_D1 = 1
MY_INT_D10   = 10
 
I would like to override these values from a higher level template:
[%# ---- file2.tt that calls file1.tt ---- %]
[% INCLUDE file1.tt  MY_BOOL_D0 = 1
                              MY_BOOL_D1 = 0
                              MY_INT_D10   = 20 %]
 
If I run this Interestingly, I get
MY_BOOL_D0 = 1
MY_BOOL_D1 = 1
MY_INT_D10   = 20
 
i.e the boolean values that had a default of 1 could not be overridden from the calling template. All other values/types were overridable. Any ideas?
 
Thanks

Reply via email to