Closed (fixed)
Project:
Views (for Drupal 7)
Version:
5.x-1.6
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2008 at 20:38 UTC
Updated:
22 Oct 2008 at 20:30 UTC
I created a content type with CCK for uploading a document using Filefield. In the view for displaying the node, I set as display fields the Title (not as a link), field_document (the field I created with CCK), and the Body. The problem is that the field_document field is displayed twice: once by itself as it should be, and once also in the Body field (along with the text in the Body field). It seems to me that since field_document is a separate field, it should not be displayed as part of the Body.
Here is an export of the view:
$view = new stdClass();
$view->name = 'member_documents';
$view->description = 'Docs available to all members';
$view->access = array (
0 => '3',
1 => '4',
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = 'Member Documents';
$view->page_header = '';
$view->page_header_format = '3';
$view->page_footer = '';
$view->page_footer_format = '3';
$view->page_empty = '';
$view->page_empty_format = '3';
$view->page_type = 'table';
$view->url = 'member_documents';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->menu = TRUE;
$view->menu_title = '';
$view->menu_tab = FALSE;
$view->menu_tab_weight = '0';
$view->menu_tab_default = FALSE;
$view->menu_tab_default_parent = NULL;
$view->menu_tab_default_parent_type = 'normal';
$view->menu_parent_tab_weight = NULL;
$view->menu_parent_title = NULL;
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'nolink',
),
array (
'tablename' => 'node_data_field_document',
'field' => 'field_document_fid',
'label' => '',
'handler' => 'content_views_field_handler_group',
'options' => 'default',
),
array (
'tablename' => 'node',
'field' => 'body',
'label' => '',
'handler' => 'views_handler_field_body',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'document',
),
),
array (
'tablename' => 'term_node_6',
'field' => 'tid',
'operator' => 'AND',
'options' => '',
'value' => array (
0 => '25',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(node, node_data_field_document, term_node_6);
$views[$view->name] = $view;
I initially submitted this under Views, and was asked to submit it under FileField, since it looks like the field is being appended to the node body.
Comments
Comment #1
jpetso commentedNo, filefield doesn't append the HTML to the node body, it just returns its HTML output to CCK like any other field does as well. No idea what could be happening here (maybe some option that enables the whole node view to be rendered with all its fields?), anyways I'll have to recheck this before closing it. Anyways, I don't think that filefield itself is the cause of this problem.
Comment #2
wonder95 commentedOK. I had first submitted this under the Views, and was told it should go here. Should I put it under CCK?
Comment #3
dopry commentedDo you have any custom theme functions for the node? maybe its should go under cck...
Comment #4
wonder95 commentedNo, there are no custom theme functions at all.
I'll reassign it to CCK.
Comment #5
kriskd commentedIs there any further discussion on this elsewhere? I am experiencing the same thing. I have a node type with 2 cck text fields. I created a table view and those 2 cck fields appear in their column as they should, but also in the body column. Any help greatly appreciated.
Comment #6
wonder95 commentedI'm still having this problem on another site I'm working on. To answer a previous question, there are no custom theme functions being used.
It looks as though the document is being passed to the view twice. If I use list view, the document shows up twice. If I used table view, that's when I see it a second time in the body column.
Comment #7
wonder95 commentedOK, completely new site, and still seeing the same thing, this time with imagefield. When I display both the imagefield and the body in a view listing, I get the imagefield objects displayed twice. That seems to indicate pretty clearly that it is a Views issue, not a CCK issue. Reassigning to Views.
Comment #8
jpetso commentedHm... try to set the "distinct" option in your view to "Yes". Not enabling that option might be a problem for multiple-value fields because the join makes two result rows out of one. Fixes the issue?
Comment #9
wonder95 commentedThere is no "distinct" option. The only one close (at least in this view) is the "Group multiple values" option for the image field, and changing that doesn't make a difference. Also, whether or not there are multiple values doesn't make a difference. If I only have one image, it is displayed as part of the Body, and if I have multiple images, they are all displayed as part of the body.
Comment #10
jpetso commentedThere is a "Distinct" option, just that it works for the whole view, not in the CCK context. It's under "Basic settings", on the left of your view settings page. Please look it up and try it out.
Comment #11
jpetso commentedOh wait... Views 1? Then I might be wrong. Hm... hasn't it been there before still?
Comment #12
wonder95 commentedNo, I don't see an "Distinct" option, either for an individual field or the view as a whole.
Comment #13
wonder95 commentedNo, I don't see a "Distinct" option, either for an individual field or the view as a whole.
Comment #14
wonder95 commentedFound this issue today:
http://drupal.org/node/160641
The patch works great for this.
Comment #15
wonder95 commented