2

Is it possible to display dynamic result based on the URL, with the Views module?

I have a database table with thousand messages, and I would display those containing the words in the URL. For example, with test.com/variableparent/variableschild, it should display the text containing the variables_child variable.

I tried with the filter, but I have to put a specific word, not a dynamic one.

5
  • try to use php code. Global:PHP
    – jmu
    Jul 5, 2016 at 14:57
  • 1
    Really, really, don't use the PHP filter.
    – Clive
    Jul 5, 2016 at 15:12
  • Search API Jul 5, 2016 at 16:13
  • did you tried entity reference view? Jul 19, 2016 at 11:45
  • @ReesGargi I take the OP is not talking of entity references, but rather a plain database table containing messages.
    – apaderno
    Jul 19, 2016 at 12:34

1 Answer 1

1

You can do this using Views Argument Substitutions and I'm just assuming the Title field here. It should work for any text field.

  1. Add some Global: Null contextual filters to take each raw component of the url. (Provide default: Raw Value from URL 2 / 3 / 4 etc.
  2. In your views filters, add Title: Contains: ***!1***. Repeat this for however many url components there are. ***!2*** ***!3*** etc. for each Title filter.
  3. Use AND / OR in between your Title filters section to control your final result.

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.