Count lines in Drupal views plugin

I wrote myself a Drupal Views plugin and want to count the lines so I can do something with the output of every Nth line.

I can do this in the plugin preprocessor function, but if it is used more than once (for example in panels) I cannot reset the counter to zero.

Can anyone point me in the right direction here?

+2


a source to share


2 answers


The default style plugin for views adds a spinner to the view object. It is available in

$view->row_index

      



If you are overwriting a render method in a custom style plugin, remember to duplicate this function in your own render function.

+2


a source


You can take a look at the views_customfield module. ( http://drupal.org/project/views_customfield ) This module gives access to the line number in the view, as well as the ability to add PHP code to each line. Quite convenient ...



0


a source







All Articles