Wednesday 12 October 2005 11:17:15 am - 4 replies
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
Modified on Monday 17 October 2005 12:10:13 pm by Michael D.
Wednesday 12 October 2005 4:16:17 pm
Sorry, I forgot to mention: It's eZ publish 3.6.1 svn rev. 12063.
I'm including it in the pagelayout.tpl, could that make a difference?
It's the first include and there is no other var named "test" in the pagelayout.tpl.
Settings are:
TemplateCompile=enabled
ViewCaching=disabled
TemplateCache=enabled
The rest is default or not listed because I don't think they are important in this matter. If some are, please let me know and I'll post them here.
Modified on Wednesday 12 October 2005 4:17:12 pm by Michael D.
Monday 17 October 2005 2:27:20 pm
I think there should be a difference if you included the code in the pagelayout.tpl
For the test, I created a folder called "TEST RECURSION", created an override for the full view of the node, and added the code you provided.
Modified on Monday 17 October 2005 2:27:32 pm by Alexandre Abric
Monday 17 October 2005 3:08:32 pm
I tried your way with the node override but I'm still getting the same (undesirable) result.
I'll try to make a clean ez 3.6 install and test it there as well as on another system.
Hopefully this will bring me closer to the solution.
Since your response indicates this, there has to be a way to make it work.
You must be logged in to post messages in this topic!