0

I would consider myself a novice Drupal user, and I am just beginning to learn more programming in general. One thing I never really understood was contextual filters (formerly "arguments") in Views. Now that I'm learning more about programming in general, I'm beginning to understand contextual filters more, but I have a question.

So, I just set up a View page that takes an argument from the URL. We'll call the path example.com/word/%. Then in the filters for the View, I have the usual

Content: Published (Yes)

Content: Type (= Article)

along with the one in question:

Content: [Field] (= %)

My goal is to create a page that only displays nodes that have the argument (%) as the [Field] value. So,

example.com/word/boogle

should take you to a page where the value of [Field] is, for example, "boogle."

I noticed (as you probably already know) that this does not quite work. What I get is a page that, from what I can tell, essentially lists all articles on the site. To make it work properly, I also have to set Content: [Field] in Contextual Filters. I don't quite understand why this is.

To me, it seems like if I'm telling the View to look for the argument provided in the URL, that should be enough to filter the results to articles that have that argument as the [Field] value. To me, I'm passing an argument from the URL to the Filter Criteria, and it should simple as that.

I'm sure I'm skipping an obvious step of logic in my thinking, however. Can someone explain to me why it is necessary to set the Contextual Filter as well, and why it is not enough to simply tell the URL to look for an argument and then tell the View filter to use that argument?

Thank you for your help.

  • 1
    Don't set the normal filter to [field] =%, remove that one. Can you provide a screenshot? – kyletaylored Sep 12 '13 at 15:49
  • 1
    Actually, you just answered my question. So the normal filter does not handle arguments at all. Those are taken completely by the contextual filter settings. Makes sense! Thank you for the explanation. – rrr45 Sep 12 '13 at 15:56

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.