WebBasic CMS
References

foreach

data output in the cycle

The foreach statement allows you to display the dataset in a loop, for example, display a list of entries in the table.

Example

<ul data-wb-role="foreach" data-wb-table="pages" data-wb-size="10" data-wb-where='active="on"'> 
    <li>eng - {{header}}</li> 
    <empty>
            <div>The contents of the <empty> block will be shown if there are no iterations in the foreach instruction</div>
    </empty>
</ul>

This example displays a list of records in the table pages field mapping id and headers . The output is paginated to 10 records.

Control attributes :

data-wb-role
name of the user foreach
data-wb-form
name of the form from which comes the dataset
data-wb-sort
space-separated lists of field names for sorting, optionally followed by a colon indicates the sort direction :d - DESC or :ASC
data-wb-size
pagination through ajax, you specify the number of elements on the page. To disable paging, you specify the data-wb-size="false"
data-wb-from
element name of the current record contains the dataset
data-wb-index
index of the array element to output the element data-wb-from
data-wb-json
set data in json format to output in a loop
data-wb-item
name of the entry from which is taken the dataset
data-wb-field
name of the field containing the data set (used in conjunction with form and item)
data-wb-rand
when the data-wb-rand="true" data set is displayed in pseudo-random order
data-wb-limit
limit the number of results displayed
data-wb-step
splits the output into blocks of N records
data-wb-where
condition to select items
data-wb-call
name of the function that is used to prepare a data set list
data-wb-oconv
name of the function that is used to prepare the data for the current record before displaying
data-wb-tpl
when the data-wb-tpl="false" template of cicle do not created
data-wb-vars
transferred any variables added to each record cycle
empty
the contents of the <empty> block will be shown if there are no iterations in the foreach instruction