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 '16 at 14:57
  • 1
    Really, really, don't use the PHP filter. – Clive Jul 5 '16 at 15:12
  • Search API – J. Reynolds Jul 5 '16 at 16:13
  • did you tried entity reference view? – innocent rock Jul 19 '16 at 11:45
  • @ReesGargi I take the OP is not talking of entity references, but rather a plain database table containing messages. – kiamlaluno Jul 19 '16 at 12:34
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, privacy policy and cookie policy

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