I've got a while loop that displays 50 logos. But what I need is another loop that creates a new div(.autogrid\_wrapper .cte .block) every 5 images.

```
<?php
                        $cn = 1;
                        while($result->next()) {
                            if ($cn % 5 == 0) {
                            ?>
                            <div class="autogrid_wrapper cte block">
                                <div class="inner">
                                <?php } ?>
                                <div class="ce_card autogrid-type_cte n5 one_fifth autogrid_mode_auto autogrid <?php echo $class2; ?> <?php echo $class; ?> block">
                                    <div class="card_wrapper">
                                        <a class="download_image" title="<?php echo $result->name; ?>"
                                        <div class="ce_image attribute image">
                                            <div class="ce_image block">
                                                <figure class="image_container">
                                                    <img src="<?php echo $imageVar->path; ?>" onerror="this.onerror=null; this.src='files/Intershop/media/images/customers/<?php echo $rest; ?>.png'" title="<?php echo $entry->field('name')->value(); ?>" alt="<?php echo $entry->field('name')->value(); ?>" >
                                                </figure>
                                            </div>
                                        </div>
                                        </a>
                                    </div>
                                </div>
                                <div class="clear autogrid_clear"></div>
                                <?php if ($cn % 5 == 0) { ?>
                                </div>
                            </div>
                                <?php
                                }
                                $cn++;
                                ?>
                        <?php } ?>

```

I hope you guys can help me.