Wednesday 12 October 2005 2:17:15 am
Hello there. I wonder if recursion is/will be possible within a template.
What I tried as a test was: <i>test.tpl</i>
{default test=0}
{$test}+
{section show=$test | lt(5)}
{include uri="design:test.tpl" test=$test|inc}
{set test=$test|dec}
{/section}
{$test}-
{/default}
output: 0+ 1+ 2+ 3+ 4+ 5+ 5- 4- 3- 3- 3- 3-
I would expect it to work like this: <i>test2.tpl</i>
{default test2=0}
{*0*}
{$test2}+
{set test2=$test2|inc}
{*1*}
{$test2}+
{set test2=$test2|inc}
{*2*}
{$test2}+
{set test2=$test2|inc}
{*3*}
{$test2}+
{set test2=$test2|inc}
{*4*}
{$test2}+
{set test2=$test2|inc}
{*5*}
{$test2}+
{*backstepping begins*}
{$test2}-
{set test2=$test2|dec}
{$test2}-
{set test2=$test2|dec}
{$test2}-
{set test2=$test2|dec}
{$test2}-
{set test2=$test2|dec}
{$test2}-
{set test2=$test2|dec}
{$test2}-
{/default}
output: 0+ 1+ 2+ 3+ 4+ 5+ 5- 4- 3- 2- 1- 0- The second template is my idea of the transition from recursive to iterative but the recursion seems to work very different. Is there a chance this behaviour will be changed in the future or am I hoping for the impossible (due to the nature of the internal handling of this)? Thanks, Michael
|