0

How can I do the following:

  • Display all nodes of content type A (done!)
  • Add underneath each node A fields of related nodes of type B (???)

I use Drupal 7 and Views 3. This post suggests the use of Reference, Entity Refrence or Relation. However I cannot seem to make them work. Each node type A has a field refering to a type B node. How can I display fields of type B underneath each node type A?

Thanks!

  • I'm not sure it's the best way, but if like you said, you already have a field in A that can be used to find one or more B, you already have a reference. At this point you only need to tell drupal to render all the B when it renders an A, and for that you to work with those kind of nodes templates. – Astrayus May 14 '14 at 10:10
  • So Astrayus I should add PHP to the templates of node A? – Jan Werkhoven May 14 '14 at 10:16
  • The "drupal way" should be: acquire the list of nodes B inside the preprocess function of node A and make it avaible for the node A template, but i never did it myself before so look into it better. Last, inside the node A template you add the usual print render( nodeB). You may need to create a template for node B too. – Astrayus May 14 '14 at 18:35
  • An example can be how nodes and node's comments work – Astrayus May 14 '14 at 18:37

Your Answer

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

Browse other questions tagged or ask your own question.