marvell has asked for the wisdom of the Perl Monks concerning the following question:
Esteemed colleagues ...
I am using Template Toolkit and have an included component with a snippet of the form:
[% DEFAULT n = 1 %] [% x = f(n) %]
This works well unless I need to set n = 0:
[% INCLUDE snippet n=0 %]
At which point the default value is chosen.
My question, therefore, is ... is there a way of getting this to work without having to resort to this?
[% DEFAULT n = 1 %] [% IF z = 1; n = 0; END %] [% x = f(n) %]
[% INCLUDE snippet z=1 %]
Your time and efforts, as always, are appreciated.
--
Steve Marvell
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Template Toolkit, Default and Zero
by dtr (Scribe) on Aug 30, 2006 at 13:02 UTC | |
by marvell (Pilgrim) on Aug 30, 2006 at 13:31 UTC | |
by marvell (Pilgrim) on Aug 30, 2006 at 13:23 UTC | |
|
Re: Template Toolkit, Default and Zero
by davidrw (Prior) on Aug 30, 2006 at 21:31 UTC |