Peter Knight Posted March 5, 2019 Posted March 5, 2019 I have 2 repeater types working with the Repeater Matrix. To keep things simple, I have image gallery a downloads gallery. I can't quite figure out how to echo the contents from within a product_gallery. I can get the code below to display the text 'An image gallery' but not the bunch of images within this. I'm not sure though if it's my variable trail or my nested echo statement. <?php foreach($page->components as $item) { if($item->type == 'product_gallery') { echo " An image gallery..."; foreach($product_gallery->images as $photo) { echo " An image <image src='{$photo->url}'> "; } } else if($item->type == 'downloads') { echo " A download gallery... "; } } ?> Thanks P
Autofahrn Posted March 5, 2019 Posted March 5, 2019 Use $item->images instead of $product_gallery->images in your inner foreach loop. 2
Peter Knight Posted March 5, 2019 Author Posted March 5, 2019 1 hour ago, Autofahrn said: Use $item->images instead of $product_gallery->images in your inner foreach loop. Thanks
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