Download & Extend

Display the total count of results of a view

Project:Views Custom Field
Version:6.x-1.0
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hi,

(sorry for my bad english)

I want to create a view in wich there is a column that display for each node the results of another view (the node Id of each node of the first view is the argument of the second view).

Do you undersand me ?

For example :

View 1 : the titles of nodes of a specific content type are displayed.

View 2 : This view is shown in a block in each nodes of the specific content type. The node id is the argument of this view.

I want to display the count of results of views 2 in view 1. Is it possible ?

In the view 1, I have created a custom field php, but I don't understand what code I must write.

Can you help me ?

Thanks !

Comments

#1

Solution :

<?php
$node_id
= $data->node_vid;
$view_args = array($node_id);
$display_id = 'Bloc';
$view = views_get_view('name_of_the_view');
    if (!empty(
$view)) {
    
$view->execute_display($display_id , $view_args);
}
$count = count($view->result);

print
$count;
print
" fois";
?>

#2

Title:How to display the total count of results of a view ?» Thanx vstmusic!!!
Assigned to:Anonymous» b3nnyT
Status:active» closed (fixed)

Excellente!

This helped me alot!!!

#3

Title:Thanx vstmusic!!!» Display the total count of results of a view
Assigned to:b3nnyT» Anonymous
nobody click here