felted Posted October 11, 2019 Share Posted October 11, 2019 Hi, i have tow repeaters on a site with five fields. foreach ($child->Portrait_Repeater as $data) { $i = 1; foreach($data as $person_data){ $content .= $i.": ".$person_data."<br />"; $i++; } } The foreach outputs sixten fields: 1: 1113 2: 1570437779-0381-1 3: 1 4: 0 5: 0 6: sort 7: 41 8: 41 9: 1570437779 10: 1570439027 11: 1570437833 12: max.jpg 13: Max Mustermann 14: Rektor 15: 1234 - 56789 16: info@maxundmoritz.de Where are the first 11 fields coming from? Thanks, Detlef Link to comment Share on other sites More sharing options...
BitPoet Posted October 11, 2019 Share Posted October 11, 2019 Behind the scenes, repeater entries are individual pages, so when you iterate over an entry (your second loop), you iterate over all the properties of the repeater page. You can see that if you change your code to: foreach ($child->Portrait_Repeater as $data) { $i = 1; foreach($data as $prop => $person_data){ $content .= $i.": $prop => ".$person_data."<br />"; $i++; } } The solution is to remove the inner loop and address the properties by name instead, like $person_data->email, $person_data->position etc. 3 1 Link to comment Share on other sites More sharing options...
felted Posted October 13, 2019 Author Share Posted October 13, 2019 Top! I learn a lot on this place Thank you very much. Detlef Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now