Hi,

My Problem :

I want to display the number of results (the total count) of a view whose is embed in each node, but the views depends of an argument (node : Id). My question : How to pass the argument. Actually, the result is always "0". How can I select the argument of my view that I want to pass ?

What I actually put in the COMPUTED CODE FIELD :

$view_name = 'doc_bloc_document_cite_dans';
$display_id = 'Bloc';
$view_args = array();
$view = views_get_view($view_name);
$view -> execute_display($display_id, $view_args);
$count = count($view->result);
$node_field[0]['value'] = $count;

Comments

vstmusic’s picture

With thi code :

$view_name = 'doc_bloc_document_cite_dans';
$display_id = 'Bloc';
$nid = arg(1);
$view = views_get_view($view_name);
$view -> execute_display($display_id, $nid);
$count = count($view->result);
$node_field[0]['value'] = $count;

arguments of the nodes 1, 2, 3, 4 ,5, 6, 7, 8, 9 are passed in the view, but after these numbers, arguments passe only the first number. for example: For the ID node 51, the argument passed is 5 and not 51.

Can you help me to correctly pass the enterely argument number ?

Thanks for your help !!!

mmjvb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)