How can I give unique identifier to the <a>
element in my second for loop? Perhaps an ascending attribute like num="1"
. The for loop is the output of using @thguenther’s Kirby-Images plugin.
<?php foreach($pieces as $piece): ?>
<div id="<?= $piece->uid() ?>">
<?php foreach($piece->thumbnails()->yaml() as $image): ?>
<?php if($image = $piece->image($image)): ?>
<a href="<?= $piece->url(); ?>" class="load" data-slug="<?php echo str::slug($piece->title())?>">
<img src="<?php echo imgix($image, array('w' => 300)) ?>" />
</a>
<?php endif ?>
<?php endforeach; ?>
</div>
<?php endforeach ?>