Hashtag Loop for Iterating over Bucket Keys
This page uses Hashtag Variable Buckets to demonstrate Bucket Loops.
Values are set using duplicated keys, then all values are processed and displayed grouped by key.
Processing this Hashtag Markup:
<#
set my_bucket.0.name to "Apple";
set my_bucket.0.type to "Fruit";
set my_bucket.1.name to "Banana";
set my_bucket.1.type to "Fruit";
set my_bucket.2.name to "Cat";
set my_bucket.2.type to "Animal";
set my_bucket.3.name to "Dog";
set my_bucket.3.type to "Animal";
#>
<h2>Fruits and Animals</h2>
<# start loop for my_bucket; #>
<hr>
key = <# key #><br>
value.name = <# value.name #><br>
value.type = <# value.type #><br>
<# end loop #>
Fruits and Animals
key = 0
value.name = Apple
value.type = Fruit
key = 1
value.name = Banana
value.type = Fruit
key = 2
value.name = Cat
value.type = Animal
key = 3
value.name = Dog
value.type = Animal