Installation and Setup for Node Reference View

The Node Reference module defines a field type for use by the Content Creation Kit (CCK) to reference one node from another. It works very good and allows you to add a greater amount of complexity to your site. The only problem with the Node Reference module is that the default display options for the referenced node field are very limited. But thanks to the Node Reference Views module, you can use all the formatting power of the Views module to display your referenced node field.

An often used example of when to use this module is for creating a music library listing using CCK: Content types are created for the albums and the songs, then Node Reference is used to relate the songs to their respective albums. For this example we will have a content type called Album with text fields for title, year, artist and a content type called Song with a simple text title and a node refernce field to relate the song to the Album called field_album_reference. From here, I will give quick setup instructions to get you going with the Node Reference Views module:

  1. Prerequisites

    Before you begin, you should have the following modules installed:

    Content -
    Node Reference - included with the Content module
    Option Widget - included with the Content module
    Text - included with the Content module
    Views -
    Views UI - included with the Views module

    Additionally, you should setup the above described songs and albums content types or have a set of content types connected by a node reference field.

  2. Download and Install Node Reference Views Module

    Node Reference Views -

    Once you have downloaded the module, move it to the appropriate modules folder for your install and extract it in place. From the Modules page (Administer > Site building > Modules), enable the Node Reference Views module.

  3. Clone and Re-Name Preinstalled View

    From the views administration page (Administer > Site building > Views) enable the view entitled field_noderef_example after reading the brief description/instructions. Now on this newly enabled view choose clone. The most important thing to rember with this setup is to rename this cloned view to have the exact same name as your node reference field, in our eample this is field_album_reference. Fill in the view description and the view tag with something that will help you remember what this view is, and then choose next.

    Modify the view by choosing additional fields from the referenced node to be displayed as well as modifying most of the rest of the view settings to suit your needs. Do not change the arguments field. Finally, Save the view.

  4. Disable Preinstalled View

    From the views administration page (Administer > Site building > Views) disable the previously enabled the view entitled field_noderef_example.

  5. Edit the Display of your Node Reference Field

    Edit your content type (Administer > Content management > Content types) that contains your node reference field. From the tabs choose Display Fields. Choose view from pulldown on your node reference field, in our example it would be the Album field.

    Now when you view your song nodes, the Album field will appear as the view you previously described. Nice. It can be styled like any other view can be.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Is there an update of this

Is there an update of this tutorial for Drupal 7. Very curious on the contributions made for this type of scenario.

Unfortunately Relationships

Unfortunately Relationships seem to occur at a 1:1 level.

So say I a content type of FAQ, and it is extended with node ref. In an example node, I edit and add 4 nodereference links to other (related FAQs).

Now in Views, I have 2 choices:
a) I can build FOUR relationships, indexed by Delta, and arrive at my 4 values. But got help me if the content type allowed "unlimited" noderef links. :-)

b) I can have the views grab the raw output of Node Reference. Unfortunately, Node Reference output is pretty limited in that it does not present additional fields like NID and Title... it hardcodes a URL around the Title (and exposes no other data about the referred node). The /node/123 URLs are OK for simple Drupal sites, but if you use custom pathing (as is done with Panels pages) then you are stuck. In your Views templates however you can chop up the NodeRef URLs and reconstruct them as you needed... but it is a pain.

But if you need just 1 result from the Views Relationship, this IS a good solution. :-)

Tnx man, na drupal setkani

Tnx man, na drupal setkani mas u mna pivo :)

HI, I read your post of 'Node

I read your post of 'Node reference View' and it worked great for my requirement. I also struggled a lot getting to show only those fields from refered Node that I wanted and fields like 'Title' (which we have no control over) are no more showing...........
woah! thanks for this wonderful tip on how to make the view work. I was great.

I am also stuck on how to style 'view' properly....can you throw some light on this?

much thanks

You can go ahead and style

You can go ahead and style like you would any other view. First you should choose a display style then dig into the css. I just started using Semantic Views ( for styling and am loving it.

hi my names hakan .. very

hi my names hakan .. very nicepost comment .. admin cool .. tnx all ..

Nice tutorial! May I take

Nice tutorial!

May I take parts of it to improve the documentation for the module?

-- Joachim (maintainer :)

I would feel proud to

I would feel proud to contribute to the documentation.

Thank you! I've added a

Thank you!

I've added a summary here and linked back to this walkthrough.

BTW, I noticed on reading more closely, you don't need to run update.php when you install modules, only when you update them :)

-- Joachim

Struggled to get Node

Struggled to get Node Reference working correctly. The tips here filled out the missing links.

Thank you.

Post new comment

  • Allowed HTML tags: <em> <strong>
  • Lines and paragraphs break automatically.

More information about formatting options

Enter the characters shown in the image.