I created a view mode named "small-sidebar" and here I need to print current row position number in this block...

I'm using this code :

    <article class="large-sidebar-article">
      <div class="article-image">
        <?php echo $content['small_image']; ?>
      <div class="label-no">
        <?php echo $label; ?>
    <div class="article-title">
      <?php echo $content['title']; ?>
        <?php  echo $content['read_more_link']; ?>
    <?php render($node); ?>

but it not show the current position

in the div class lebel-no I need to print the current position

  • what is your mean current row position ?
    – Yuseferi
    Nov 28, 2013 at 11:27
  • means views-row position Nov 28, 2013 at 11:53
  • can u get a screenshot of your views and put here?
    – Yuseferi
    Nov 28, 2013 at 13:43

1 Answer 1


You can do this in two steps below,

STEP : 1

Add the views result counter under the fields option Ex: Fields Global: View result counter Content: Title Content: Body

Screen shot on adding a View result counter

STEP : 2

If you want to theme it in your own way add the following tpl.php file in your theme folder,


I have added the following html to theme it like a tab

<span style="margin-bottom: 20px;padding: 5px;border-radius: 3px;background: #479ED2;color:#fff;">
    View result counter:<?php print $output; ?>

Thats all about bringing a view counter in your block.

Screen shot on bringing views counter variable in block

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.