Block position in the area

Permalink
How to check Block position in the area (the first block 1, the following block 2

Below code shows that "%4$s" print block numbers. Like row1,row2,row3

$a = new Area('Main');
$a->setBlockWrapperStart('<div class="row%4$s">', true);
$a->setBlockWrapperEnd('</div>');
$a->display($c);

This function is not working in 5.7, so how can print block numbers in blockwrapper?

 
psd2concrete5 replied on at Permalink Best Answer Reply
Hi,

You can use javascript for that....
<script type="text/javascript">
$(window).load(function() {
    $(".row").each(function(i) {
        $(this).attr('id', "row" + (i + 1));
    });
});
</script>
planetweb replied on at Permalink Reply
It works .
Thanks Rajesh.
drumrby replied on at Permalink Reply
drumrby
Is it possible to use PHP for this?

What I'm trying to do is display the Block Position Number in the block. I've tried modifying your code using the code below:

<script type="text/javascript">
$(window).load(function() {
    $("#mag_pg").each(function(i) {
        $('.pg_num').append('<p>Page ' + (i + 1) + '</p>');
    });
});
</script>


It displays the text but each block displays the Block Position Number for all blocks. For instance, if I have 3 blocks, every block in that area would have <p>Page 1</p><p>Page 2</p><p>Page 3</p> at the bottom.