I have a simple view, that displays nodes using a style of unformatted and a row style of node.
I am using a variant of a node.tpl.php to style each node. My issue is that I need to know which node I am working on in the list. If views returns 10 nodes, I need to know which node is where in the list. At the node.tpl.php level, I can't find a var that tells me that, nor can I see a place to set it and have it fall down like in views-view-unformatted.tpl.php, there in the loop, I could create the count var, but I can't pass it to the node.tpl.php as the row object there is already themed.
Comments
Comment #1
drupalnuts commentedComment #2
nevets commentedThis might help, at the top of node.tpl.php try adding
Comment #3
drupalnuts commentedOh that is very cool.
On the themeing information for the views, it should state some place that the $view object is there to be used.
Comment #4
ygerasimov commentedThat works great! but what if we have pager? this method gives numbers only of the page. how to get the page number (i think it can be done from url of the page) and number of the nodes on the page?
thank you in advance.
Comment #5
dawehnerThere is a field Global: counter, which does exact this.
I think you can use this.
Comment #6
davedg629 commentedYes there is the field Global: result counter, but that field is only available when creating a field View. If you are using a node view then you have to do this at the theme level somewhere. Anyone have a solution to #4?
Comment #7
dawehnerYou can get the page number by $view->get_current_page();