Tuesday 30 September 2003 2:20:59 pm
Hi all. I would like to create a section that does something different on the first iteration than for all subsequent iterations. I am attempting to fetch related objects for my example. I placed the following code in an article with 3 related objects:
{let runcheck=0}
{section show=count($node.object.related_contentobject_array)|gt(0)}
{section name=Rel loop=$node.object.related_contentobject_array}
{switch name=FirstRun match=$runcheck}
{case match=0}
First Run runcheck = {$runcheck}<br />
{set $runcheck=1}
{/case}
{case}
Sebsequent Run runcheck = {$runcheck}<br />
{/case}
{/switch}
{/section}
{/section} {/let}
This returns:
First Run runcheck = 0
First Run runcheck = 0 First Run runcheck = 0 Hardly the desired result. I tried using $#runcheck=1 but it made no difference. I read the documentation on let and set and namespaces. Is it even possible for me to change the value of $runcheck inside my switch or do I need to come at this another way? Thanks in advance.
working at www.wardnet.com
blogging at www.jamesward.ca
|