2

Created a content type x. Fields: title, body, serviceareas. Added 5 nodes.

View1

Created a views page:

  1. Views path: house/%.

  2. Contextual Filter: added nid.

  3. Selected body field to display.

View2

Created a views block:

  1. Added nid. Excluded from display.

  2. Added Title field. Output field as a link > link path: house/[nid]

    Results:

  3. When I click a title from the block, I get views page accordingly.

    Addition:

    View3

  4. I would like to add one more views block which will select serviceareas field for that node.

  5. This block will only display in all the views page.

    When I click the title link (step 5), I like to display the body field(it works now already). I also like to display serviceareas field (step 7) to views 1 and views 2. I am not sure how to join the views 3 to views 1 and views 2? So that I can see serviceareas related to the views page I am on.

    Example:

    Node/1 Title: title1 Body: body1 Serviceareas: serviceareas1.

    Node/2 Title: title2 Body: body2 Serviceareas: serviceareas2.

    When I click the title 1(views 2), views page(views1) should display body1(works) and on the same page another region, views block(views 3) should display serviceareas1.

    When I click the title 2(views 2), views page(views1) should display body2(works) and on the same page another region, views block(views 3) should display serviceareas2.

enter image description here

------------------------<<<

I placed views2 and views3 block in the same region. Views 2 should display all the nodes titles(works). Views3 should display only field from the nid(does not work).

Views3 block: I added one field. Contextual filter: I added nid.

When I click a title link from views2, I get body from views1 page but I do not get the field from views3 block. Below is the view3 block -contextual section. enter image description here

1 Answer 1

2

If I understand your question correctly, you want to display the result of a View into another View. You can do this by using the contributed module Views Field View:

views_field_view allows you to embed one view into another view and pass arguments along

By using this module you can add an extra field to your View1 and View2, which shows the result of your View3.

===

In your updated question, Views3 has become a separate block. Using a contextual filter you can limit the rows to be only from a specific node (id), the one that is being displayed. The answer on How to associate the current Node ID when running from Block layout? should point you in the right direction, your contextual filter should be similar to the one you used in View1.

7
  • Views3 block will be displayed in a separate region. Will that work?
    – autop
    Jan 8, 2017 at 0:40
  • I interpreted "I am not sure how to join the views 3 to views 1 and views 2", that you want to show the contents of View3 in the other ones. But, your comment indicates that this is not the case. Is View3 also a block, if so, why can't you apply a contextual filter to View3 (which I assume you already did for View2)?
    – Watergate
    Jan 8, 2017 at 0:47
  • Views 3 is a separate block. I am confused how to use contextual filter in my case. What field should I select for contextual filter?Some specifics would help?
    – autop
    Jan 8, 2017 at 1:16
  • 1
    It worked now. I did not clear the cache before. Thank you much.
    – autop
    Jan 8, 2017 at 22:11
  • 1
    Yes, clearing the cache does wonders ;) :)
    – Watergate
    Jan 8, 2017 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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