Support

Account

Home Forums Add-ons Repeater Field Repeater sub field display by group based on value Reply To: Repeater sub field display by group based on value

  • If the array is sorted in the right order something like this will show them… I’m guessing at a bit of this because you didn’t actually give the field names and you’ll need to adjust the loop to output what you want. This is just an example of how to loop through an array that has been grouped together by one of it’s elements.

    
    $last_group = ''; // initialize the group name
    foreach ($personArray as $person) {
      $this_group = $person['group_name'];
      if ($this_group != $last_group) {
        echo '<h2>',$person['group_name'],'</h2>';
      }
      $last_group = $this_group;
      echo '<p>'.$person['person_name'].'</p>';
    }