Forum
Re-use a special ID value in the same template
Does anyone know if it is possible to generate a unique ID with the perch_item_index
or _id
function and the re-use the generated ID in the same template? The comments in the following template show what I mean…
<section class="<!-- Generate a unique ID here -->">
<div class="container">
<div class="row">
<div class="col-md-12">
<h3></h3>
</div>
<perch:repeater id="Fotos" label="Fotos">
<div class="">
<a class="" href="#" data-lightbox="<!-- Re-use the generated ID here -->" data-title="#" >
<img class="" src="#" alt="" /></a>
</div>
</perch:repeater>
</div>
</div>
</section>
Thanks Robert, I've tried this method but the second time
<perch:content id="_id" />
is used, it generates no output.That's because you're in a repeater. You need to bring the parent IDs into scope.
I missed the repeater tag, sorry. Drew's answer will have you working. :)
Great, that does the trick. Thanks Drew an Robert! I'm loving Perch and I'm more and more getting the hang of it, but sometimes all of the options are a bit overwhelming. It's good to have this forum!