[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Incrementing a scatch variable.
****** message to minivend-users from Hans-Joachim Leidinger <jojo@buchonline.net> ******
Aboubacar Diare wrote:
> Does anyone know how to increment a scratch variable?
> The following is a portion of the code i am using:
>
> [if scratch count == 6]
> </tr><tr>
> [else]
> [set count][scratch count + 1][/set]
> [/else]
> [/if]
>
> i initially set count to 1. It does not increment count for some reason
> in the [else] statement.
>
> Any help would be appreciated. Thank you.
Hmmm...which some reason?
test...with a loop (e.g. 25 or more)
count = 1 -> if count == 6 --> no --> count = count +1 = 2
count = 2 -> if count == 6 --> no --> count = count +1 = 3
count = 3 -> if count == 6 --> no --> count = count +1 = 4
count = 4 -> if count == 6 --> no --> count = count +1 = 5
count = 5 -> if count == 6 --> no --> count = count +1 = 6
count = 6 -> if count == 6 --> YEEESS! --> </tr><tr>
count = 6 -> if count == 6 --> YEEESS! --> </tr><tr>
count = 6 -> if count == 6 --> YEEESS! --> </tr><tr>
count = 6 -> if count == 6 --> YEEESS! --> </tr><tr>
.
.
.
count = 6 -> if count == 6 --> YEEESS! --> </tr><tr>
count = 6 -> if count == 6 --> YEEESS! --> </tr><tr>
and so on ....
Hmmm...maybe i miss something like
[if scratch count == 6]
</tr><tr>
[set count]1[/set]
[else]
[set count][scratch count + 1][/set]
[/else]
[/if]
Maybe this can help..
[if scratch count == 6]
</tr><tr>
[perl arg=scratch]
$Safe{'scratch'}->{'count'} = 1;
return '';
[/perl]
[else]
[perl arg=scratch]
$a = $Safe{'scratch'}->{'count'} + 1;
$Safe{'scratch'}->{'count'} = $a;
return '';
[/perl]
[/else]
[/if]
or without any setting of scratch count at the start
[if scratch count == 6]
</tr><tr>
[perl arg=scratch]
$Safe{'scratch'}->{'count'} = 0;
return '';
[/perl]
[/if]
[perl arg=scratch]
$a = $Safe{'scratch'}->{'count'} + 1;
$Safe{'scratch'}->{'count'} = $a;
return '';
[/perl]
Regards,
Joachim
--
-------------Hans-Joachim Leidinger---------------------
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list