I have a simple grid view with a contextual view to filter the records. It is based on this article.

For example the url ../cats101/mollie correctly filters the animal with the name Mollie in the view cats101.

I have a block display for the view and want to place this block in the content position of a content type page animals and have the contextual filter show the filtered view - i.e when page url = ..content/mollie#overlay-context=cats101/mollie, I want the view just to show the record for Mollie.

I have tried to achieve this by checking the box only show on listed pages and entering the value content/%1 but nothing appears. I sense I am nearly there - but what am I doing wrong ? Thanks.

Comments

sprite’s picture

On the block administration page you want to specify something like:

content/*

Only on the Views design page do you want to use the - /taxonomy/term/% - type of URL specification.

Keep in mind that the Views contextual filter is always using the raw URL /taxonomy/term/% to capture the associated taxonomy term ID, not the user friendly URL alias that may be presented to the user on the website.

spritefully yours
Technical assistance provided to the Drupal community on my own time ...
Thank yous appreciated ...

peterk900’s picture

I have changed Show Block on Specific Pages - Only the Listed Pages content/* . The result can be viewed here. It shows the selected Cat with a comment option but it does not remove the other nodes.

Here is the link to the view If you click on of the cats then you get the display referred to above. So if the other cats did not appear the result would be as it should be.

sprite’s picture

It is just a long proposition to try to diagnose Views problems blind.
There are just too many settings and too much configuration involved to try to answer a Views question other than very specific ones.

spritefully yours
Technical assistance provided to the Drupal community on my own time ...
Thank yous appreciated ...

peterk900’s picture

Yes I agree - remote diagnosis here is not easy. Thanks for helping me so far.
I found this video which guided me to a solution. Here are the changes I made:

In the View

  • Set the Number of records per page to 1
  • Set the filter on Content ID - not the name, which appears in the url
  • Option - When the filter is not in the url: Check Provide a default value and set the dropdown value to Content ID from URL
  • If you want to change the view title to reflect the record selected then: Check the Override Title under WHEN THE FILTER VALUE IS IN THE URL OR A DEFAULT IS PROVIDED and enter %1 for first parameter [It shows the name not the id, suprisingly !]

In the block:

  • Under Show block on specific pages, check Only the listed pages inserting the value Content/*
  • In the left pane - Visibility settings, Content Types - select the content type

Powerful stuff !

sprite’s picture

You are seeing evidence of what I tried to explain above.

Views is never using the "names" to determine contextual filters.
Even when some alias "name'" for something exists in the URL, Views is always using the underlying ID, whether a node ID, or a taxonomy term ID, or whatever.

spritefully yours
Technical assistance provided to the Drupal community on my own time ...
Thank yous appreciated ...

peterk900’s picture

Agreed absolutely ! Thanks for re-enforcing the point about id's v. names.

(The number of records = 1 isn't needed, as in this case there is only one. But the above should work if there were multiple i.e a 1 to many situation.)