<div class="cappers">
    <?php foreach($cappers as $capper):?>
        <div class="capper">
            <div class="capper-header">
                <div class="title">
                    <span class="header-title"><?php echo $capper['title']; ?></span>
                </div>
            </div>
            <div class="capper-body">
                <?php if (isset($capper['logo']['url'])): ?>
                    <?php $primary_capper++;  ?>
                    <div class="logo">
                        <img src="<?php echo $capper['logo']['url']; ?>" alt="Image">
                    </div>
                <?php endif; ?>

                <?php if (!empty($capper['name'])): ?>
                    <?php $primary_capper++;  ?>
                    <div class="name">
                        <span><?php echo $capper['name']; ?></span>
                    </div>
                <?php endif; ?>

                <?php if (!empty($capper['score'])): ?>
                    <?php $primary_capper++;  ?>
                    <div class="score separator">
                        <span><?php echo $capper['score']; ?></span>
                    </div>
                <?php endif; ?>

                <?php if (is_array($capper['more_cappers']) && count($capper['more_cappers']) > 0): ?>
                    <div class="scores">
                        <?php $i = ($primary_capper == 0) ? 1 : 2; ?>
                        <?php foreach($capper['more_cappers'] as $more): ?>
                            <div class="score separator">
                                <div class="score-name"><?php echo $i.'. '.$more['name'] ?></div>
                                <div class="score-score"><?php echo $more['score']; ?></div>
                            </div>
                            <?php $i++; ?>
                        <?php endforeach; ?>
                    </div>
                <?php endif; ?>
            </div>
        </div>
    <?php endforeach; ?>
</div>
