Hello,
I could learn about the View module, and I find it as a very powerful tool, but what I could't find is the possibillity to create a view for ONLY ONE NODE for example a particular content type (every single node) will be shown in specific view. It means I will click on the topic/node/article in menu and the node (made in certain type) will appear in one specific view.
I hope someone can help me, I posted this question already on 3 forums and did't get even "bitchy" answer :)

Comments

nevets’s picture

Normally one would use templating to do this using a template that overrides node.tpl.php. For example you could add to your themes template file (template.php)

hook_process_node(&$variables) {
  $node = $variables['node'];

  $variables['template_files'][] = 'node-' . $node->nid;
}

replacing 'hook' with your theme name.

Then you could copy node.tpl.php to node-{nid}.tpl.php (where {nid} is an actual node id) to specifically theme a single node.

drupal3008’s picture

I don't think that's what the op meant. I think they wanted to utilize views to select fields, etc. to display for that single node view.

I'm looking to do the same thing using views, any help would be appreciated it. I would think it would involve utilizing arguments or something (so if I had a path of /products/50 the views would override the default node.tpl.php and pull the views for that instead)

chrisshattuck’s picture

Hello homer,

It also sounds to me like this is a job for a template file. However, if you want to really just use a view, you could set the view to return just 1 result and use Views arguments to pull the specific node. For example, with the URL "/myview/40", you would use the second argument (40) and use that to restrict the view to that particular node.

If you wanted to override the default node display, as makingbigthings mentioned, you'll need to use a template file, and then embed a view inside of it. You would add the view as a variable inside of the page preprocessing function in your template.php file, and then use that variable in the template file. It sounds a bit convoluted, but once you get the process down it will be really easy the next time you do it.

Cheers,
Chris

Build a Module.com - The definitive video guide to Drupal development

Learn virtually any aspect of Drupal on BuildAModule, where I've recorded over 2200 video tutorials.

JmsCrk’s picture

This would be very handy if it were possible.

A module that has the same flexibility as the views 'fields' display type, including all the field display options and the possibility of rewriting field output. My designer finds this method much easier than tpl files.

It would be great to see a module that makes the content type display page at eg admin/content/node-type/page/display work the same way as the views fields display does.

| websites | drupal | marketing || chocchip.com.au |

nevets’s picture

Have you looked at the Display Suite module.

JmsCrk’s picture

Wow, that looks very interesting, some good documentation there too at first glance. I'll test it this weekend!

| websites | drupal | marketing || chocchip.com.au |