I have a folder structure set up as:
I am trying to display a section with just hp images and another with just em images. Currently I have this working (with the help of this forum)
<?php foreach ($page->children() as $child): ?> <div><?php echo $child->uid() ?></div> <div> <?php foreach($child->images()->filterBy('filename', '*=', 'HP') as $image): ?> <a href="<? echo $image->url() ?>"><img src="<? echo $image->url() ?>" alt="<? echo $image->title() ?>" /></a> <?php endforeach ?> </div> <?php endforeach ?>
This results in lots of empty sections and one hp image displaying. How can I have it display only the child folder with a hp image? if statement? hasImages()?