otinanaipali
New Member
I use a custom template to display elements by name.
This is what I use to display the field "supplier_name" from group "supplier":
This displays elements from groups that are not repeatable.
However, when it comes to repeatable groups this code doesn't behave as I expected. What php code should I use to display a field from a repeatable group? Let's say I have a repeatable group "products", and I need to display all repeated values of the element "product_description"
This is what I tried but it doesn't work:
If I use this:
It just displays only the last field value of the repeatable group.
Please for some help here.
This is what I use to display the field "supplier_name" from group "supplier":
Code:
$this->element = $this->groups['supplier']->elements['supplier_name'];
echo $this->loadTemplate('element');
However, when it comes to repeatable groups this code doesn't behave as I expected. What php code should I use to display a field from a repeatable group? Let's say I have a repeatable group "products", and I need to display all repeated values of the element "product_description"
This is what I tried but it doesn't work:
Code:
$subgroup = $this->groups['products']->subgroups;
$this->element = $this->subgroup->elements['product_description'];
echo $this->loadTemplate('element');
If I use this:
Code:
$this->element = $this->groups['products']->elements['product_description'];
echo $this->loadTemplate('element');
Please for some help here.