Hướng dẫn exposed Filters với Views 3 trong Drupal 7

Hướng dẫn exposed Filters với Views 3 trong Drupal 7

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":

Hướng dẫn exposed Filters với Views 3 trong Drupal 7

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.

A basic example of Drupal exposed views.

And that's it! This is the foundation for all kinds of user defined filtering that you can set up. Go forth and build!

Additional resources:

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Khanh Hoang

Khanh Hoang - Kenn

Kenn is a user experience designer and front end developer who enjoys creating beautiful and usable web and mobile experiences.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 

Đặt Drupal Block vào bên trong một node

This tutorial will show you how to take a block and place it inside a Drupal node.

Running Drupal in Kubernetes with Docker in production

Running Drupal trong Kubernetes với Docker in production

You might think that Drupal and Docker work together nicely. They definitely can and do, in many cases, as we see with local development environments built around Docker

Communicate for FREE through Nimbuzz Android App

Communicate for FREE through Nimbuzz Android App

The Android Market is full of multinetworking instant messaging clients and Nimbuzz is one of them.

Công ty diệt chuột T&C

 

Diet con trung