Hi,
I try to show a little message on top of one of my views which specify the number of results found by the view.
I used to put this snippet in the views-view.tpl.php file
<?php echo format_plural(max(0, $view->total_rows), '1 <em>result</em>', '@count <em>results</em>'); ?>
It worked well until I patched View to the last dev version. Now, total_rows is null even if the view show something.
I hope that somebody will have a idea to patch this.
Thanks
Here is an export of my view :
$view = new view;
$view->name = 'clone_de_annonces';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Clone de Annonces';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_text'] = 'plus';
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'better_exposed_filters';
$handler->display->display_options['exposed_form']['options']['submit_button'] = 'Rechercher';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Réinitialiser';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Trié par';
$handler->display->display_options['exposed_form']['options']['autosubmit'] = 0;
$handler->display->display_options['exposed_form']['options']['autosubmit_hide'] = 1;
$handler->display->display_options['exposed_form']['options']['bef'] = array(
'sort' => array(
'bef_format' => 'default',
'combine' => 0,
'reset' => 0,
'reset_label' => '',
),
'keys' => array(
'more_options' => array(
'bef_filter_description' => 'Ex : Chaises, barrières...',
),
),
'term_node_tid_depth' => array(
'bef_format' => 'default',
'more_options' => array(
'bef_select_all_none' => 0,
'bef_collapsible' => 0,
'bef_filter_description' => '',
),
),
'field_department_value' => array(
'bef_format' => 'default',
'more_options' => array(
'bef_select_all_none' => 0,
'bef_collapsible' => 0,
'bef_filter_description' => '',
),
),
);
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'list';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['hide_empty'] = 0;
$handler->display->display_options['row_options']['default_field_elements'] = 1;
/* Comportement en l'absence de résultats: Global : Zone de texte */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['label'] = 'Empty';
$handler->display->display_options['empty']['area']['empty'] = FALSE;
$handler->display->display_options['empty']['area']['content'] = 'Aucune annonce dans cette catégorie';
$handler->display->display_options['empty']['area']['format'] = 'plain_text';
$handler->display->display_options['empty']['area']['tokenize'] = 0;
/* Relation: Contenu : Catégorie (field_category) */
$handler->display->display_options['relationships']['field_category_tid']['id'] = 'field_category_tid';
$handler->display->display_options['relationships']['field_category_tid']['table'] = 'field_data_field_category';
$handler->display->display_options['relationships']['field_category_tid']['field'] = 'field_category_tid';
$handler->display->display_options['relationships']['field_category_tid']['label'] = 'category';
$handler->display->display_options['relationships']['field_category_tid']['required'] = 1;
/* Relation: Terme de taxonomie : Terme parent */
$handler->display->display_options['relationships']['parent']['id'] = 'parent';
$handler->display->display_options['relationships']['parent']['table'] = 'taxonomy_term_hierarchy';
$handler->display->display_options['relationships']['parent']['field'] = 'parent';
$handler->display->display_options['relationships']['parent']['relationship'] = 'field_category_tid';
$handler->display->display_options['relationships']['parent']['label'] = 'category parent';
$handler->display->display_options['relationships']['parent']['required'] = 0;
/* Relation: Contenu : Département (field_department) */
$handler->display->display_options['relationships']['field_department_tid']['id'] = 'field_department_tid';
$handler->display->display_options['relationships']['field_department_tid']['table'] = 'field_data_field_department';
$handler->display->display_options['relationships']['field_department_tid']['field'] = 'field_department_tid';
$handler->display->display_options['relationships']['field_department_tid']['label'] = 'department';
$handler->display->display_options['relationships']['field_department_tid']['required'] = 1;
/* Champ: Contenu : Titre */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_type'] = '0';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 0;
/* Champ: Contenu : Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['label'] = '';
$handler->display->display_options['fields']['body']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['body']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['body']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['body']['alter']['external'] = 0;
$handler->display->display_options['fields']['body']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['body']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['body']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['body']['alter']['max_length'] = '150';
$handler->display->display_options['fields']['body']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['body']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['body']['alter']['strip_tags'] = 1;
$handler->display->display_options['fields']['body']['alter']['trim'] = 1;
$handler->display->display_options['fields']['body']['alter']['html'] = 0;
$handler->display->display_options['fields']['body']['element_type'] = '0';
$handler->display->display_options['fields']['body']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['body']['element_default_classes'] = 1;
$handler->display->display_options['fields']['body']['hide_empty'] = 0;
$handler->display->display_options['fields']['body']['empty_zero'] = 0;
$handler->display->display_options['fields']['body']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['body']['settings'] = array(
'trim_length' => '150',
);
$handler->display->display_options['fields']['body']['field_api_classes'] = 0;
/* Champ: Contenu : Photo */
$handler->display->display_options['fields']['field_picture']['id'] = 'field_picture';
$handler->display->display_options['fields']['field_picture']['table'] = 'field_data_field_picture';
$handler->display->display_options['fields']['field_picture']['field'] = 'field_picture';
$handler->display->display_options['fields']['field_picture']['label'] = '';
$handler->display->display_options['fields']['field_picture']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_picture']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_picture']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_picture']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_picture']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_picture']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_picture']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_picture']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_picture']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_picture']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_picture']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_picture']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_picture']['element_type'] = '0';
$handler->display->display_options['fields']['field_picture']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_picture']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_picture']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_picture']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_picture']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['field_picture']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_picture']['settings'] = array(
'image_style' => 'list',
'image_link' => '',
);
$handler->display->display_options['fields']['field_picture']['group_rows'] = 1;
$handler->display->display_options['fields']['field_picture']['delta_limit'] = '1';
$handler->display->display_options['fields']['field_picture']['delta_offset'] = '0';
$handler->display->display_options['fields']['field_picture']['delta_reversed'] = 0;
$handler->display->display_options['fields']['field_picture']['field_api_classes'] = 0;
/* Champ: Terme de taxonomie : Numéro */
$handler->display->display_options['fields']['field_dpt_number']['id'] = 'field_dpt_number';
$handler->display->display_options['fields']['field_dpt_number']['table'] = 'field_data_field_dpt_number';
$handler->display->display_options['fields']['field_dpt_number']['field'] = 'field_dpt_number';
$handler->display->display_options['fields']['field_dpt_number']['relationship'] = 'field_department_tid';
$handler->display->display_options['fields']['field_dpt_number']['label'] = '';
$handler->display->display_options['fields']['field_dpt_number']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_dpt_number']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_dpt_number']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['element_type'] = '0';
$handler->display->display_options['fields']['field_dpt_number']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_dpt_number']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_dpt_number']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['field_dpt_number']['settings'] = array(
'thousand_separator' => '',
'prefix_suffix' => 0,
);
$handler->display->display_options['fields']['field_dpt_number']['field_api_classes'] = 0;
/* Champ: Contenu : Type */
$handler->display->display_options['fields']['field_type']['id'] = 'field_type';
$handler->display->display_options['fields']['field_type']['table'] = 'field_data_field_type';
$handler->display->display_options['fields']['field_type']['field'] = 'field_type';
$handler->display->display_options['fields']['field_type']['label'] = '';
$handler->display->display_options['fields']['field_type']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_type']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_type']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_type']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_type']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_type']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_type']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_type']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_type']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_type']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_type']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_type']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_type']['element_type'] = '0';
$handler->display->display_options['fields']['field_type']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_type']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_type']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_type']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_type']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['field_type']['field_api_classes'] = 0;
/* Champ: Terme de taxonomie : Nom */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'taxonomy_term_data';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['relationship'] = 'parent';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['name']['alter']['external'] = 0;
$handler->display->display_options['fields']['name']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['name']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim'] = 0;
$handler->display->display_options['fields']['name']['alter']['html'] = 0;
$handler->display->display_options['fields']['name']['element_type'] = '0';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['name']['element_default_classes'] = 1;
$handler->display->display_options['fields']['name']['hide_empty'] = 1;
$handler->display->display_options['fields']['name']['empty_zero'] = 0;
$handler->display->display_options['fields']['name']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['name']['link_to_taxonomy'] = 1;
/* Champ: Contenu : Catégorie */
$handler->display->display_options['fields']['field_category']['id'] = 'field_category';
$handler->display->display_options['fields']['field_category']['table'] = 'field_data_field_category';
$handler->display->display_options['fields']['field_category']['field'] = 'field_category';
$handler->display->display_options['fields']['field_category']['label'] = '';
$handler->display->display_options['fields']['field_category']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_category']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_category']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_category']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_category']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_category']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_category']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_category']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_category']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_category']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_category']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_category']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_category']['element_type'] = '0';
$handler->display->display_options['fields']['field_category']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_category']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_category']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_category']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_category']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['field_category']['field_api_classes'] = 0;
/* Champ: Contenu : Prix */
$handler->display->display_options['fields']['field_price']['id'] = 'field_price';
$handler->display->display_options['fields']['field_price']['table'] = 'field_data_field_price';
$handler->display->display_options['fields']['field_price']['field'] = 'field_price';
$handler->display->display_options['fields']['field_price']['label'] = '';
$handler->display->display_options['fields']['field_price']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_price']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_price']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_price']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_price']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_price']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_price']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_price']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_price']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_price']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_price']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_price']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_price']['element_type'] = '0';
$handler->display->display_options['fields']['field_price']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_price']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_price']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_price']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_price']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['field_price']['settings'] = array(
'thousand_separator' => ' ',
'decimal_separator' => '.',
'scale' => '2',
'prefix_suffix' => 1,
);
$handler->display->display_options['fields']['field_price']['field_api_classes'] = 0;
/* Champ: Contenu : Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['label'] = '';
$handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nid']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['nid']['alter']['external'] = 0;
$handler->display->display_options['fields']['nid']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['nid']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['nid']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nid']['alter']['html'] = 0;
$handler->display->display_options['fields']['nid']['element_type'] = '0';
$handler->display->display_options['fields']['nid']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['nid']['element_default_classes'] = 1;
$handler->display->display_options['fields']['nid']['hide_empty'] = 0;
$handler->display->display_options['fields']['nid']['empty_zero'] = 0;
$handler->display->display_options['fields']['nid']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['nid']['link_to_node'] = 0;
/* Champ: Contenu : Département */
$handler->display->display_options['fields']['field_department']['id'] = 'field_department';
$handler->display->display_options['fields']['field_department']['table'] = 'field_data_field_department';
$handler->display->display_options['fields']['field_department']['field'] = 'field_department';
$handler->display->display_options['fields']['field_department']['label'] = '';
$handler->display->display_options['fields']['field_department']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_department']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_department']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_department']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_department']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_department']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_department']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_department']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_department']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_department']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_department']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_department']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_department']['element_type'] = '0';
$handler->display->display_options['fields']['field_department']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_department']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_department']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_department']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_department']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['field_department']['type'] = 'taxonomy_term_reference_plain';
$handler->display->display_options['fields']['field_department']['field_api_classes'] = 0;
/* Champ: Terme de taxonomie : Numéro */
$handler->display->display_options['fields']['field_dpt_number_1']['id'] = 'field_dpt_number_1';
$handler->display->display_options['fields']['field_dpt_number_1']['table'] = 'field_data_field_dpt_number';
$handler->display->display_options['fields']['field_dpt_number_1']['field'] = 'field_dpt_number';
$handler->display->display_options['fields']['field_dpt_number_1']['relationship'] = 'field_department_tid';
$handler->display->display_options['fields']['field_dpt_number_1']['label'] = '';
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['element_type'] = '0';
$handler->display->display_options['fields']['field_dpt_number_1']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_dpt_number_1']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_dpt_number_1']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['field_dpt_number_1']['settings'] = array(
'thousand_separator' => '',
'prefix_suffix' => 0,
);
$handler->display->display_options['fields']['field_dpt_number_1']['field_api_classes'] = 0;
/* Critère de tri: Contenu : Épinglé (en haut des listes) */
$handler->display->display_options['sorts']['sticky']['id'] = 'sticky';
$handler->display->display_options['sorts']['sticky']['table'] = 'node';
$handler->display->display_options['sorts']['sticky']['field'] = 'sticky';
$handler->display->display_options['sorts']['sticky']['order'] = 'DESC';
/* Critère de tri: Contenu : Date de publication */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['exposed'] = TRUE;
$handler->display->display_options['sorts']['created']['expose']['label'] = 'Date';
/* Critère de tri: Contenu : Prix (field_price) */
$handler->display->display_options['sorts']['field_price_value']['id'] = 'field_price_value';
$handler->display->display_options['sorts']['field_price_value']['table'] = 'field_data_field_price';
$handler->display->display_options['sorts']['field_price_value']['field'] = 'field_price_value';
$handler->display->display_options['sorts']['field_price_value']['exposed'] = TRUE;
$handler->display->display_options['sorts']['field_price_value']['expose']['label'] = 'Prix';
/* Critère de tri: Contenu : Type (field_type) */
$handler->display->display_options['sorts']['field_type_value']['id'] = 'field_type_value';
$handler->display->display_options['sorts']['field_type_value']['table'] = 'field_data_field_type';
$handler->display->display_options['sorts']['field_type_value']['field'] = 'field_type_value';
$handler->display->display_options['sorts']['field_type_value']['exposed'] = TRUE;
$handler->display->display_options['sorts']['field_type_value']['expose']['label'] = 'Type';
/* Filtre contextuel: Contenu : Possède l'identifiant de terme de taxonomie (avec profondeur) */
$handler->display->display_options['arguments']['term_node_tid_depth']['id'] = 'term_node_tid_depth';
$handler->display->display_options['arguments']['term_node_tid_depth']['table'] = 'node';
$handler->display->display_options['arguments']['term_node_tid_depth']['field'] = 'term_node_tid_depth';
$handler->display->display_options['arguments']['term_node_tid_depth']['title_enable'] = 1;
$handler->display->display_options['arguments']['term_node_tid_depth']['title'] = '%1';
$handler->display->display_options['arguments']['term_node_tid_depth']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['term_node_tid_depth']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['term_node_tid_depth']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['term_node_tid_depth']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['term_node_tid_depth']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['term_node_tid_depth']['depth'] = '2';
$handler->display->display_options['arguments']['term_node_tid_depth']['break_phrase'] = 0;
$handler->display->display_options['arguments']['term_node_tid_depth']['set_breadcrumb'] = 0;
$handler->display->display_options['arguments']['term_node_tid_depth']['use_taxonomy_term_path'] = 0;
/* Critère de filtrage: Contenu : Publié */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Critère de filtrage: Contenu : Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'annonce' => 'annonce',
);
/* Critère de filtrage: Contenu : État (field_state) */
$handler->display->display_options['filters']['field_state_value']['id'] = 'field_state_value';
$handler->display->display_options['filters']['field_state_value']['table'] = 'field_data_field_state';
$handler->display->display_options['filters']['field_state_value']['field'] = 'field_state_value';
$handler->display->display_options['filters']['field_state_value']['value'] = array(
1 => '1',
);
/* Display: Recherche */
$handler = $view->new_display('page', 'Recherche', 'search');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'Résultats de la recherche';
$handler->display->display_options['exposed_block'] = TRUE;
$handler->display->display_options['defaults']['empty'] = FALSE;
/* Comportement en l'absence de résultats: Global : Zone de texte */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['label'] = 'Empty';
$handler->display->display_options['empty']['area']['empty'] = FALSE;
$handler->display->display_options['empty']['area']['content'] = 'La recherche n\'a donné aucun résultat';
$handler->display->display_options['empty']['area']['format'] = 'plain_text';
$handler->display->display_options['empty']['area']['tokenize'] = 0;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Critère de filtrage: Contenu : Publié */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Critère de filtrage: Contenu : Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'annonce' => 'annonce',
);
$handler->display->display_options['filters']['type']['group'] = 0;
/* Critère de filtrage: Contenu : État (field_state) */
$handler->display->display_options['filters']['field_state_value']['id'] = 'field_state_value';
$handler->display->display_options['filters']['field_state_value']['table'] = 'field_data_field_state';
$handler->display->display_options['filters']['field_state_value']['field'] = 'field_state_value';
$handler->display->display_options['filters']['field_state_value']['value'] = array(
1 => '1',
);
$handler->display->display_options['filters']['field_state_value']['group'] = 0;
/* Critère de filtrage: Recherche : Termes de recherche */
$handler->display->display_options['filters']['keys']['id'] = 'keys';
$handler->display->display_options['filters']['keys']['table'] = 'search_index';
$handler->display->display_options['filters']['keys']['field'] = 'keys';
$handler->display->display_options['filters']['keys']['group'] = 0;
$handler->display->display_options['filters']['keys']['exposed'] = TRUE;
$handler->display->display_options['filters']['keys']['expose']['operator_id'] = 'keys_op';
$handler->display->display_options['filters']['keys']['expose']['label'] = 'Quoi ?';
$handler->display->display_options['filters']['keys']['expose']['operator'] = 'keys_op';
$handler->display->display_options['filters']['keys']['expose']['identifier'] = 'keys';
$handler->display->display_options['filters']['keys']['expose']['remember'] = 1;
$handler->display->display_options['filters']['keys']['expose']['multiple'] = FALSE;
/* Critère de filtrage: Contenu : Possède les termes de taxonomie (avec profondeur) */
$handler->display->display_options['filters']['term_node_tid_depth']['id'] = 'term_node_tid_depth';
$handler->display->display_options['filters']['term_node_tid_depth']['table'] = 'node';
$handler->display->display_options['filters']['term_node_tid_depth']['field'] = 'term_node_tid_depth';
$handler->display->display_options['filters']['term_node_tid_depth']['group'] = 0;
$handler->display->display_options['filters']['term_node_tid_depth']['exposed'] = TRUE;
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['operator_id'] = 'term_node_tid_depth_op';
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['label'] = 'Dans';
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['operator'] = 'term_node_tid_depth_op';
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['identifier'] = 'category';
$handler->display->display_options['filters']['term_node_tid_depth']['expose']['reduce'] = 0;
$handler->display->display_options['filters']['term_node_tid_depth']['reduce_duplicates'] = 0;
$handler->display->display_options['filters']['term_node_tid_depth']['type'] = 'select';
$handler->display->display_options['filters']['term_node_tid_depth']['vocabulary'] = 'categories';
$handler->display->display_options['filters']['term_node_tid_depth']['hierarchy'] = 1;
$handler->display->display_options['filters']['term_node_tid_depth']['error_message'] = 1;
$handler->display->display_options['filters']['term_node_tid_depth']['depth'] = '2';
/* Critère de filtrage: Contenu : Possède les termes de taxonomie (avec profondeur) */
$handler->display->display_options['filters']['term_node_tid_depth_1']['id'] = 'term_node_tid_depth_1';
$handler->display->display_options['filters']['term_node_tid_depth_1']['table'] = 'node';
$handler->display->display_options['filters']['term_node_tid_depth_1']['field'] = 'term_node_tid_depth';
$handler->display->display_options['filters']['term_node_tid_depth_1']['exposed'] = TRUE;
$handler->display->display_options['filters']['term_node_tid_depth_1']['expose']['operator_id'] = 'term_node_tid_depth_1_op';
$handler->display->display_options['filters']['term_node_tid_depth_1']['expose']['label'] = 'Où ?';
$handler->display->display_options['filters']['term_node_tid_depth_1']['expose']['operator'] = 'term_node_tid_depth_1_op';
$handler->display->display_options['filters']['term_node_tid_depth_1']['expose']['identifier'] = 'department';
$handler->display->display_options['filters']['term_node_tid_depth_1']['expose']['reduce'] = 0;
$handler->display->display_options['filters']['term_node_tid_depth_1']['reduce_duplicates'] = 0;
$handler->display->display_options['filters']['term_node_tid_depth_1']['type'] = 'select';
$handler->display->display_options['filters']['term_node_tid_depth_1']['vocabulary'] = 'departements';
$handler->display->display_options['filters']['term_node_tid_depth_1']['hierarchy'] = 1;
$handler->display->display_options['filters']['term_node_tid_depth_1']['error_message'] = 1;
$handler->display->display_options['filters']['term_node_tid_depth_1']['depth'] = '1';
$handler->display->display_options['path'] = 'annonces/recherche';
$translatables['clone_de_annonces'] = array(
t('Master'),
t('plus'),
t('Rechercher'),
t('Réinitialiser'),
t('Trié par'),
t('Asc'),
t('Desc'),
t('Empty'),
t('Aucune annonce dans cette catégorie'),
t('category'),
t('category parent'),
t('department'),
t('Date'),
t('Prix'),
t('Type'),
t('Tous / Toutes'),
t('%1'),
t('Recherche'),
t('Résultats de la recherche'),
t('La recherche n\'a donné aucun résultat'),
t('Quoi ?'),
t('Dans'),
t('Où ?'),
);
Comments
Comment #1
Anonymous (not verified) commentedSame issue here. $view->total_rows is empty. I'm using 7.x-3.0-rc1 though.
Comment #2
duaelfrFirst, fix the pagers with : http://drupal.org/node/1090098#comment-5104580
Then, for views not using a pager, use the attached patch.
Comment #3
dawehnerMh this is a good question, should this be counted like this, because total_rows is actually another information.
If you want to have the total_items you can set a flag with $view->get_total_rows = TRUE; else you can do a count($view->result) for your own.
But sure i'm open for discussion whether it makes sense to calculate the "total rows" like this.
Comment #4
duaelfrI think that the cost of these 3 lines of code is really insignificant for the entire module and it allows to deal with this data in a consistent way regardless of a pager configuration.
Moreover, this allow themers to access this information without having to write a custom module to enable get_total_rows.
Comment #5
dawehnerBut well if you do this it will contain a variable which is not expected, as it's not the total row count.
Comment #6
duaelfrI don't understand or I may be mistaken somewhere.
If there is no pager set for the view, all the results will be stored in the view->result array so using count on it will retreive the total row count.
In which case this count would not be exact ?
Comment #7
dawehnerWell total_rows should store the count of ALL rows not only them in $view->result.
Comment #8
duaelfrIs it possible, in the case where there is NO PAGER set on the view, that the $view->result variable does not contain ALL the rows ? If it is, could you give me an example ? Thank you
Comment #9
dawehnerYes it's. You can choose to only display a certain amount of items, but you still have more items available in the theory. This does not run the count query.
Comment #10
duaelfrI thought that the "Display a specified number of items" option was a kind of pager.
So this is the limit case in which it is complicated to get the total_rows information.
The following code seems to do the job
instead of the simple "count"
It makes an additional sql request but I do not see any other simple alternative.
With more complexity we could add to the views advanced options the ability to disable total_rows calculous but I do not know if it would be very usefull.
Comment #11
dawehnerOkay i will explain the whole pager thing.
There are three cases by default:
Your patch introduces the count query for case 2 and 3, which is somehow bad :)
Comment #12
sigent commented// views 6.3 rc2
setting $view->get_total_rows (no pager) populates only $view->query->pager->total_items but never $view->total_rows. the last remains null.
Comment #13
broncomania commentedI ran into the same problem. I try to develop the datatables ajax backend and I need to get the total amount of all available results even if I display only paged 100 results, but all my attempts fail in d6.3 rc2.
I would like to get the counted results of all available results if I set the $view->get_total_rows = TRUE even if I display it in 100th steps.
Is this possible or do I have to patch something to make this working. At the moment with this setting I always get $view->total_rows = NULL. So I think this is buggy isn't it?
Comment #14
broncomania commentedWouldn't it be easier to add $view->get_total_rows ? The other patches here didn't work for me.
Comment #15
bartezz commentedI'm having similar issues as #13, it would be nice to have the total number of rows available even when one is not using a pager in case of AJAX implementations. For now I will enable the pager but just theming it out of the view...
Cheers
Comment #16
merlinofchaos commentedFor performance reasons, when not using a pager total_rows is not filled in. If you know you'll be needing it, you can set $view->get_total_rows = TRUE to always do this. dereine has already said this.
I find it incredibly frustrating that a lot of people are complaining that this information isn't always available and are trying to patch it in. There are valid reasons why you should NOT request that data if you don't want it. You want to add potentially significant performance hits to every site that uses views, always, so that you can avoid setting a flag? Please try to understand that there are hundreds of thousands of installations of this software.
This is not a bug, and this is by design. On your site, you can in a custom module do this:
No code hacks or silly patches to slow down everyone else's site are required.
Comment #17
bartezz commentedAppologies! I did miss the part in dereine's #3 comment where she pointed to a solution. Thanx for repeating the issue.
I understand what you're saying performance, point taken.
Cheers
Comment #18
jurgenhaasPerfectly reasonable, thanks for the explanation. However, instead of having to write custom code wouldn't it be more convenient if there was a flag in the views UI to allow changing that setting interactively?
Comment #19
merlinofchaos commentedTypically one only needs the value with custom code? I don't think the UI can utilize the value. Am I wrong on this?
Comment #20
jurgenhaasWell, I came across the situation quite regularely where a customer asked be to include the total number of rows it the header or footer of a view and so far I had to go into custom code to achieve that. Still possible but not quite as convienient as a UI solution could be.
Comment #21
duaelfrI agree with jurgenhaas.
As a developper I have no problem building a tiny module to acheive this. However, a lot of site builders would like to see a "Force total row count" option in Views UI and just have to echo this value in their template.
Comment #22
mstrelan commentedYes, $view->total_rows is used by views. See views_handler_area_result.inc in the render() function.
$total = $this->view->total_rows;To use the default result summary that is packaged with views you cannot use "Display all items".
Even if I do set $view->get_total_rows the result summary still doesn't work. Can someone explain what's going on with this code in views_plugin_query_default.inc function execute()
But then later when total_rows is set it doesn't check for use_count_query or get_total_rows
Shouldn't the latter be as below?
Unless there is something missing this seems to make more sense to me. Not rolling a patch right now, just btw.
Comment #23
DanzI-1 commentedI agree with mstrelan,
should be there
Comment #24
DanzI-1 commentedhere is the patch for that
Comment #25
tim.plunkettComment #26
dawehnerThis looks totally reasonable, though it would be great to have some tests, to be sure it will not be broken sometime in the future.
This shouldn't be to hard, as it's setting this variable, and check whether the count is set.
Comment #27
duaelfrI think it would be interesting to give the control on this variable in the UI by adding an entry in the "Advanced" section, wouldn't it ?
Comment #28
dkinzer commentedI'm in agreement with @dawehner this needs a test. I'm changing this needs work. I'm working on adding a test:
Comment #29
dkinzer commentedResubmitting same patch as #24 plus added SimpleTest.
Comment #30
dkinzer commentedForgot to apply the assert message.
Comment #31
tim.plunkettCleaned up the test a little, and uploading the patch split up to prove the test does something.
Comment #32
tim.plunkettAssigning to dawehner for review.
Comment #33
dawehnerAwesome, thanks for the test especially, this really helps to not run into future regressions!
Committed to 7.x-3.x and 8.x-3.x
Comment #35
catchApplies to 6.x-3.x as well.
Comment #36
dawehnerAnd I was sure I have seen DualFR previously in the issue queues.
Committed to 6.x-3.x and pushed
Thank you for posting this to 6.x-3.x as well