Drupal Tutorials: Exposed Filters with Views
With views, it's easy to create a restricted listing of content. What's more, you can also expose those filters to the user, so they can sort and filter the content themselves. Here's an example of the type of functionality you can enable with "exposed filters":
So here's how you set up a simple exposed filter, using Views 3 in Drupal 7:
1. Make sure views is installed, and enabled, and that you're looking at the admin screen of the view you are interested in.
2. Create the filter criteria that we want our users to be able to control, by clicking the "Add" button, in the filter criteria box.
3. I want to expose a filter that allows users to choose which content types are listed, so for my filter criteria, I'll check Content: Type, and click "Apply".
4. On the next screen, check the option "Expose this filter to visitors, to allow them to change it. There are lots of other options, but I'll just leave it at the defaults and click "Apply".
5. Now you can scroll to the bottom of your views admin page and click "Preview" to see a demo of the functionality. Use the select box under "Type" to choose the content type, and click "Apply" to repopulate the view. It works!
6. We can click Save, to save the view, and browse to the path we defined ("/my-new-view"), to see it on the site.
And that's it! This is the foundation for all kinds of user defined filtering that you can set up. Go forth and build!