Single search field (exposed filter) for multiple fields in views
How to create a single exposed filter in a view(one search box) that will search in many fields.
i found this solution on the web and i want to share with you.
- Install the "Computed Field" Module
- Create a computed field
- Inside of it, just aggregate the field you want to search on.
Example : $node_field[0]['value'] = strip_tags($node->title.' '.$node->body);If you have a CCK field, you put .$node->field_mycckfield[0]['value'].Note that I used strip_tags to get only plain text.
Then you can just expose this field in Views and it'll search on (here) title and body at once.
The "bad" thing is that it stores things twice in the database but It works and it is not inconvenience for the end-user.
Grupos:
- Versión para impresión
- Inicie sesión o regístrese para enviar comentarios
