2

I have a vocabulary which contains a large number of terms, most of which have been given relationships to other terms.

I want to create a block display of a view which takes the term from the current node and displays all the other content which has a related term from the same vocabulary.

So far, I have been able to return all nodes with the same term using this as a views argument:

node = node_load(arg(1));
if($node) {
foreach($node->taxonomy as $term) { $terms[] = $term->tid; }
return implode('+',$terms);
} else { return; }

However, I haven't been able to combine this with taxonomy_get_related to return nodes related by term. Any suggestions?

1

You probably have to do the follwing:

  • create a view
  • add a block to that view
  • add a contextual filter (in Drupal 6 it is an Argument)
  • configure it with:
    • Action to take if argument is not present: Provide default argument
    • Default argument type: Node ID from URL
    • Validator: taxonomy term
    • You can use Term ID from the URL, or try to use the term name.

Then you have to save and configure the block to show on the desired page...

These settings in Drupal 7 (more or less, there are some slight differences in interface) work for me...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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