LassoScript Utility
Basics Browse Detail

[Loop] ... [/Loop]

Tag Link [Loop] ... Category Conditional
Type Container Source Available No
Support Preferred Version 2.5
Change Unchanged Data Source Any
Output Type None Security None
Implementation Internal Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0, Lasso 3.x, Lasso 2.5

Description

[Loop] ... [/Loop] repeats the contents of the container tag a specified number of times. A single parameter specifies the number of times the tag should loop. The [Loop_Count] tag can be used within the container to return the value of the current loop from 1 up to the end value.

Optional -From and -To parameters allow the loop to loop between any two values. [Loop: -From=11, -To=20] ... [/Loop] will loop 10 times and [Loop_Count] will report the values 11, 12, 13, ..., 20.

An optional -By parameter allows the increment of the loop to be changed. [Loop: 10, -By=2] ... [/Loop] will loop 4 times and [Loop_Count] will report the values 1, 3, 5, 7, 9.

The -By parameter can be used with the -From and -To parameters to loop down. [Loop: -From=10, -To=1, -By=(-1)] ... [/Loop] will loop 10 times and [Loop_Count] will report the values 10, 9, 8, ..., 1.

Syntax

[LoopLoop Count] ... [/Loop]

[Loop-From=Start Value,
     -To=End Value,
     -By=Increment]
   ... 
[/Loop]

Parameters

Optional Parameters
Loop Count The number of iterations the loop should perform.
-From The starting value for loop iterations.
-To The ending value for loop iterations.
-By The number which should be used to modify the loop count on each loop iteration. Defaults to 1.

Change Notes

In prior versions of Lasso this tag accepted -LoopFrom, -LoopTo, and -LoopIncrement parameters. These have been replaced by -From, -To, and -By respectively. The older parameters have been deprecated, but will continue to work without modification.

Examples

To repeat a portion of a page a set number of times:

Use the [Loop] ... [/Loop] tags with an integer value in the opening tag. The contents of the tags will be repeated the specified number of times.

[Loop: 3]
  <br>This is repeated 3 times.
[/Loop]

<br>This is repeated 3 times.
<br>This is repeated 3 times.
<br>This is repeated 3 times.

Related Tags

Category Tags