forloop

forloop

For next loop with an index between the from and to values

Example

[%forloop from:'1' to:'10' %]
    [%param *header%]
      <select name="qty">
    [%/param%]
    [%param *body%]
        <option value="[@current_index@]">[@current_index@]</option>
    [%/param%]
    [%param *footer%]
      </select>
    [%/param%]
[%/forloop%]

Parameters

Name Options Description
from:'' Integer Starting value
to:'' Integer Final value
*header HTML & b@se tags Renders a single usable space above the body
*body HTML & b@se tags Runs an array for each option in the tag
*footer HTML & b@se tags Renders a single usable space below the body
*ifempty, ifempty:'' HTML & b@se tags If the forloop returns no results, it'll load this block instead

Note: this function works based on incrementing the value by 1.

Data Tags (body)

Name Example Description
[@count@] 0 Counter starting at 0
[@current_index@] 1 Counter starting at 1
[@from_index@] 1 Starting value. Same as from:''
[@tot_index@] 10 Ending value. Same as to:''

Was this article useful?

Be notified when this page is updated. Optional.