2

I'm not even sure I know enough about Drupal to ask the question properly, but here goes. I've managed to make a drupal view that displays submitted locations on a map of people who all received the same physical card. Under the map, anecdotes etc of how people received that card appear. I'll spare you the rest of the details.

You can see what I mean here: http://www.wwghosting.com/sevendeg/final-leaf-test

Anyway, what I would like now is: if someone searches the site, for say card 2701, they will be shown a page that looks like that.

The problem is, I had to manually make that view with a filter that filters out card #2701 and anyone who submitted that card.

If I had to do it that way, I'd have to make 5000 views manually if we had 5000 cards. Also, the map there is just shown in the header of another view, so really, it's two views in one page.

What I want is for a display similar that to be automatically made if someone searches for card 2701. Or once they submit a card, I want them to be redirected to that page.

I think somewhere I read that it is possible to render a view from URL info, but not sure if that's the way to go about things.

Thanks in advance for any help/guidance.

-Todd

0

What you're looking for is Contextual Filters. Rather than creating many views, you create one view that accepts an argument to change the value of one or more filters. In your case, the filter is the card number.

There are many ways to do this. One way is to pass the value of the card to the view by URL argument. This can be done with query string parameters at the end of the URL (which you can set as hard links in HTML that the user clicks on. Another option is using a very specialized configuration of Panels module, where it will pass a URL argument to a view which is contained in one of its panel panes. See https://drupal.org/node/1584046

Those options are only necessary if you need the value to be pre-populated when the user visits the page. They are a bit tricky to implement, but something that Drupal does very well once you know how to configure it.

The other option is to set an exposed filter on your view. On the view configuration page, click on your filter and check the box to expose the filter. Then, there will be an input area when you load the view on your page, which will accept any valid values for your filter.

| 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.