Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have a drupal 6 view where I am displaying nodes using row style Node. I want to edit the way the Node row style.

I edited the file /modules/node/node.tpl.php and commented the line

print $picture;

just for testing.

I was expecting that the picture field of each node would vanish. But I saw no change in the view display. Why is this?

share|improve this question
    
have you flushed the cache ? –  mohit_rocks Nov 24 '12 at 10:36
    
No success even after flushing cache. –  Shuaib Nov 24 '12 at 10:45
    
Is your view set to display fields or content? –  Clive Nov 24 '12 at 11:43
    
It is set to display Content –  Shuaib Nov 24 '12 at 11:55
2  
Just to clarify...$picture refers to the user picture, not an image field, in the node template file. Are you saying the user picture is still shown even after you remove that line? –  Clive Nov 24 '12 at 12:42
show 1 more comment

1 Answer 1

The documentation for the plugin says:

The node row style will display each item of the view through Drupal's standard node_view() function. Views has very little control over this output, except for the options you see. You can choose from different Build modes. By default there are "Teaser" and "Full node". You can also decide if you want to "Display links" and/or "Display node comments".

Because the output is run through the standard node template mechanism (typically node.tpl.php or a variant thereof), any decisions about what is output may be done there.

Views does add an extra 'suggestion' to the list of possible node templates: node-view-VIEWNAME.tpl.php—you may use this to theme a node specifically for the view. This can be handy for creating very small teasers and the like.

The template file could be different from node.tpl.php if there are other template files suggested for the content type, or a node in particular; the Views module itself suggests a template file whose name depends from the view name. Then, between the node.tpl.php defined from the Node module, and the same file defined from the theme, the latter is the used one.

The rendering method use for that plugin is views_plugin_row::render(), which contains the following code.

return theme($this->theme_functions(), $this->view, $this->options, $row, isset($this->field_alias) ? $this->field_alias : '');

With Drupal 7, the method is views_plugin_row_node_view::render(), which contains the following code.

  if (isset($this->nodes[$row->{$this->field_alias}])) {
    $node = $this->nodes[$row->{$this->field_alias}];
    $node->view = $this->view;
    $build = node_view($node, $this->options['view_mode']);

    return drupal_render($build);
  }

References

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.