[ic] loop-last confusion

Grant listbox at email.com
Thu Nov 6 13:33:56 EST 2003


> At 12:23 PM 11/6/2003 -0800, you wrote:
> >Could someone please explain to me why this stops after 9
> iterations (as it
> >should):
> >
> >[loop search="ml=100000/ra=yes"]
> >         [loop-code]
> >         [loop-last][if type="explicit" compare="[loop-increment] ==
> >9"]1[/if][/loop-last]
> >[/loop]
> >
> >and this does not:
> >
> >[tmp listing_counter]0[/tmp]
> >[loop search="ml=100000/ra=yes"]
> >         [tmp listing_counter][calc] [scratch listing_counter] + 1
> > [/calc][/tmp]
> >         [loop-code]
> >         [loop-last][if type="explicit" compare="[scratch
> listing_counter] ==
> >9"]1[/if][/loop-last]
> >[/loop]
> >
> >- Grant
>
> ... because all the [loop-*] stuff is parsed *before* the free-standing
> [tmp][/tmp] assignment. In your first example, the [if..] is enclosed in
> [loop-last], forcing it to be interpolated at the desired time. Please
> correct me anyone if I am wrong. There used to be a document which
> explained interpolation order in Interchange, and perhaps there still is,
> but I can't put my finger on it. I know that catalog and server variables
> get parsed before looping tags, which in turn get parsed before
> non-looping
> tags.
>
> - Ed L.

Ok, thanks Ed.  I guess it's that the [scratch listing_counter] isn't even
parsed yet when the evaluation is made.  That's the only thing that makes
the result make sense.

I need to terminate a loop after a certain condition has been met within the
loop a certain number of times.  Any idea how to make that happen?

- Grant



More information about the interchange-users mailing list