b:loop Tag - Blogger Tags References

Loop Syntax:
<b:loop values='ARRAY' var='VARIABLE_NAME'>
<!-- Code to Be Executed Here -->
</b:loop> Attributes used for b:loop tag
| Attributes | Classification | Prefix "expr:" | Description | Strictness |
|---|---|---|---|---|
| values | XML Blogger Expression | authorized | Table arrayto extract in the loop. The expected value can be an explicit value, a data item or a Blogger expression whose type is array To create an expression, use:
| Mandatory |
| var | HTML classic | authorized | The expected value is any variable name that will contain the values of the items in the array. As an indication, in the gadget model supplied by default, Blogger engineering has chosen for most tables, the name of the table in the singular (without "s"). For example, the variable used for the array data:posts is post. | Mandatory |
| index | HTML classic | authorized | The expected value is a character string. This attribute provides the index number in the loop. | Optional |
| reverse | HTML classic | authorized | This attribute reverses the direction of the loop. The expected value must be boolean(boolean). Either true (true) or false (false). When this attribute is not mentioned the default value is false (false). The value can also be a Blogger expression, the result of which returns a Boolean value. Note: The attribute does not affect the numbering of the index. | Optional |
Get Items from an Array:
General Example:
<b:loop index='i' expr:reverse='data:view.isArchive' values='data:videos' var='video' >
<!-- INDEX -->
<data:i/>
<!-- ITEM -->
<data:video.itemName/>
</b:loop> An Object Array - Example:
<b:loop values='data:posts' var='post' >
<!-- ITEM -->
<data:post.title/>
</b:loop> A singleton Array - Example:
<b:loop values='["Mickey","Donald","Dingo"]' var='character' >
<!-- ITEM -->
<data:character/>
</b:loop>
Comments
Post a Comment