Forum
Can I count inside blocks?
Using blocks to create sections on a single page site and using the title of each block to create the page menu. However, I'd like to display the count:
- Item
- Item
- Item
- Item ...
Is it possible to output the count as I loop through the blocks:
<perch:blocks>
<perch:block type="text" label="Text">
<li class="active"><span class="num">1</span><span class="text"><perch:content id="text_block_title" /></span></li>
</perch:block>
</perch:blocks>
Have you checked the output of
<perch:showall />
? I think there's a count.Doing that shows I have access to
_block_index
which would be fine but it start with 0. I could manipulate it with JS but that's not ideal...You can adjust it with a template filter.