Hey: I’m building a slider with a counter.
But the images are manually sorted and filtered with ->sortBy('sort')
Now if I use ->indexOf()
I get the index of where an item is placed in the alphamumeric order.
How can I resolve this?
<?php $filtered = $page->images()->filterBy('skip', false) ?>
<?php $amount = $filtered->count() ?>
<?php $items = $filtered->sortBy('sort') ?>
<?php foreach($items as $item): ?>
<p class="counter"><?= $item->indexOf() + 1 ?>/<?= $amount ?></p>
<?php endforeach ?>