A list with related nodes in Drupal 6 - developed.be

I wanted to make a list of “related nodes” based on the term that is attached to the node.

Say I have 10 nodes that have the term “fruit”. With every fruit-node I want to display 5 links to other fruit-nodes.

I work with panels and views.

This turned out more time-consuming then I thought because the way to do it is not straight forward.

  1. Make a new view
  2. Add “taxonomy term id” as argument. Select “hide view” is the argument isn’t provided.
  3. Add a couple of fields to display (eg: title, teaser).
  4. Save the view. Make sure your caches are cleared.
  5. Make or edit a page (with the panels module through: Administer › Site building › Pages).
  6. Make or edit a variant.
  7. We need to add a new relationship to the variant. This will make it possible to parse the term id  to the view.
    1. Click on the tab “context” in the variant.
    2. Add a relationship. Select  “Term from node” in the dropdown and click the “Add relationship” button.
    3. A new window will open. Select the correct vocabulary (in my example: the vocabulary where “fruit” belongs to). You might want to give it a decent name so you can recognise it later.
    4. Click “ok”.
  8. In the “content” tab, add a new pane to the panel. (click the gear icon and select “add content”)
  9. Select the view you’ve just created (under the “views” tab on the right) and select the “default” view. (do not make a “content pane” in the view because this does not work that way).
  10. Normally it will show the views’ argument (term id) with a dropdown under it. In the dropdown select the term id of the relationship we created in Step 7.
  11. Click update & save. This should do.

Rss Comments

Comments

No comments yet.

Leave a comment