I know I can get row count at views-view-list level by simply adding

foreach ($rows as $id => $row)
{
 print $row;
}

But how do I pass that id to row template (views-view-fields-[...])?

What I am trying to do is to use a totally different template for the first element (this goes WAY beyond what can be done with CSS) - any ideas?

Comments

nevets’s picture

You could add this to your row style output template

<?php
$row_counter = empty($view->row_counter) ?  0 : $view->row_counter;
$view->row_counter++;
?>

and then use $row_counter to determine the current row. As show it is zero based (ie first row has a value of zero).

Etanol’s picture

Thank you very much - works perfectly