0

I have a page and a view. I have placed the view as a block on the page and there is a contextual filter defined as shown in the image

Basically when i print the arg(1) in header and see i get like 42 which is like the node id on which the view is placed. Can you please tell me what its is trying to do when its placed in the contextual filters as it was was done earlier by another person. I mean to ask how does it filter out the data based on the node id ? enter image description here

1

I am not certain if I understand what you are asking here, but this question is bound to come up on searches for anyone trying to figure out contextual filters. The information you present leads to several questions and comments:

It is unclear what your contextual filter will due without knowing more about the view fields, setting and path definition you have given it. Also, is this the contextual filter screen for the page or block?

To define the location for the argument in the path for a page view you place a % character at the location in the path definition for the view. eg. in Example.com/content/%/items, any URL value matching the path pattern will generate a view with the value of the % passed on to the contextual filter. IN this way you have a view definition performing generalized filters as defined in the first column of the view definition form page and additional filtering as defined in the third column under the 'Advanced' option. For a page view you complete the requirements for the contextual filter under the heading "When the filter value IS available or a default is provided"

For a block you must complete the section "When the filter value is NOT available" and select "Provide default value". IN the drop down list you can tell the filter whether it is intercepting a content, taxonomy or user id node number or you can tell it to select a raw value from the URL and which position in the string it is. In the example I gave above the context value we are looking for (the % sign) is in the second position.

However the value is passed, the context filter will further filter the view as defined on the view form for that page or block.

| improve this answer | |

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.