I've been trying to figure a way to output the values of several fields within a single repeater using a foreach() without having to reference the name of the fields.
Typically, for repeaters, I understand you would do foreach($repeater_field as $afield) { echo $afield->fieldname_a; } pretty straight forward.
Anyways, what I'm doing is using a single repeater as just a container for other fields.
I've tried using $page->my_repeater->getArray(), then looping through the array, and all sorts of methods, without luck. It seems I must specify the field name for output.
For instance, my (single) repeater is set up to hold a few different fields:
my_repeater
field_a
field_b
field_c
Trying to output it using something like this:
foreach($page->my_repeater as $afield) {
echo $afield->value; // I'm not wanting to have the reference the field name e.g. use $afield->field_a
}
Any suggestions?