Hi there,
I can't find the right for me.. Hope someone can help me.
I have a view "myview" with 2 fields - "title" and "nid".
Now I want to get the "nid" into the header of the current view ("myview"). Can someone help me to solve this..
PHP of Header...
$view = views_get_current_view();
GET VALUE? OF the field nid!! But how??
print "My NID is"; print ?NID? ;
Cheers Kai
Comments
Comment #1
okmi commentedi also need to do something like this. what would the syntax look like for outputting a field in the view's header or footer using php?
Comment #2
cflemm commentedI would love to know this as well!
Comment #3
dawehneri added
IN $view->result you can access the different results of the view.
Comment #4
andrenoronha commentedi'm trying to print the numbers of reads
but this 0 stands for my first result... how can I call the generic variable for each result?
p.s: I'm not using the node statistic field directly because I just want to show the reads for the author of the node. so I'm using a php customfield to print it.
Comment #5
merlinofchaos commentedIf you're using a php custom field, I would think there should be a $row variable available in the customfield. But I'm not sure, since that's not a module that I am familiar with. I know if you're theming the field, you can look at $row to see the raw data of the field.
I have to say, the initial post really failed to provide enough context. It really matters where you're doing this stuff to see how you access the information.
Comment #6
andrenoronha commentedthanks for your reply.
in fact it was easier than i thought. I just called $data which brings the data in the fields of the view.
print $data->node_counter_totalcount . ' reads.';