Forum

Thread tagged as: Question

Output perch item index in a block

Hi,

How do i output perch_item_index within a block?

i tried <perch:content id="perch_item_index" type="hidden" /> but that aaways outputs 1

so i tried <perch:block id="perch_item_index" type="hidden" /> but that breaks it

Any ideas?

Paul Langley

Paul Langley 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

perch_item_index is in the scope of the parent item, so you'll need to bring those into scope and use parent.perch_item_index to access it.

so i did <perch:content id="parent.perch_item_index" type="hidden" /> but it now outputs nothing at all

So, i tried <perch:block id="parent.perch_item_index" type="hidden" /> but this breaks it

Ta

Drew McLellan

Drew McLellan 2638 points
Perch Support

Did you add scope-parent on the blocks tag?

ah perfect thanks