[ic] Problem setting scratch in item-sub

Peter peter at pajamian.dhs.org
Sun Apr 13 00:13:11 UTC 2008

On 04/12/2008 07:21 AM, Ton Verhagen wrote:
> Dear All,
> The following code doesn't behave as I'd expected.
> Displaying cart contents:
> [item-list]
> [item-sub test_it]
> ...cut code
>          $Tag->tmp('testme', "Some value");
> ....cut code
> [/item-sub]
> [item-exec test_it][/item-exec]
> [if scratch testme]
>          scratch testme holds value: [scratch testme]
> [/if]
> [/item-list]
> The test fails while the scratch variable testme is empty.
> However, it should be possible to set a scratch in the sub routine, 
> shouldn't it?
> Am I missing something?

As far as I can tell the thing you are missing is that the [if scratch 
testme] and [scratch testme] will not be evaluated until after the loop 
is complete, so while the scratch is set in the loop ($Tag->tmp(...)) 
the evaluation of the scratch is doen after the loop and will evaluate 
against the last value you set.  I don't know what you're actually 
setting it to, but I'd venture to guess that the last value returns 
false for the purposes of the [if scratch ...] test.


More information about the interchange-users mailing list