[ic] [if scratch...]

Ed LaFrance edl@newmediaems.com
Thu, 01 Mar 2001 09:09:56 -0800


At 08:01 PM 02/28/2001 -0800, you wrote:
>Hi,
>
>I am trying to compare scratch values in an if/elsif statement, and
>tried the following code. I cannot get this to work. What I am trying do
>to is get the results of a loop search to organize into two columns. The
>first section is a loop to count the number of items in a list. if I
>replace the '[scratch count1]' variable with a number, this works fine,
>it just doesnt seem to recognise the [scratch] tag as part of the IF tag
>evaluation. Can anybody help me out.
>
>[loop.....]
>[seti count1][calc][scratch count1] + 1[/calc][/seti]
>[/loop]
>[seti count1][calc][scratch count1] / 2[/calc][/seti]
>[seti count][/seti]
><table><tr><td>
>[loop ....]
>[seti count][calc][scratch count]  + 1[/calc][/seti]
>[if scratch count < [scratch count1]] [loop-code]<br>
>[elsif scratch count == [scratch count1]] [loop-code]<br></td><td>
>[/elsif]
>[/else] [loop-code]<br>[/else][/if]
>[/loop]
></td></tr></table>
>
>Thanks

In these situations it is best to used the named syntax for the [if..]:

[if type="scratch" term="count" op="<" compare="[scratch count1]"]
..
[elsif type="scratch term="count" op="==" compare="[scratch count1]"]
...
[/elsif]
[else]...[/else]
[/if]

BTW - Have you looked into [loop-alternate]? You could simplify this code 
considerably.  [if..]'s in looping code can slow page load time dramantically.

- Ed L.