I’m using Drupal. I have a module which loads a form onto a node. In my module I used
if ( arg(0) == 'node' && is_numeric(arg(1)) ) {$node = arg(1);}
which got the nid each form was on.
Now I have created a view which displays full nodes but my nodes aren’t getting the nid displayed.
I tried using something like
$node = node_load($rows->nid);
but it didn’t return anything.
Basically I have a view page which displays about 10 nodes, and I’m trying to find the nid of each node in the view.
You can use the views custom field module which will give you access to the $data object for each row. Included in that will be the nid as
$data->nid. You can also gain access to it in aviews-row.tpl.php. If you’ve got the devel module (which is a must, really), you can usedsm(get_available_vars());to pretty-print all of the variables available to that template or justdsm($data);to pretty-print the data object in your views custom field (dsm()uses Krumo which is very handy).