Hi, I'm looking to have a drop-down search for a lyrics site I'm making. I only have three content types (artist, album, song) and would like visitors to choose one of the three types to search.

An example of what I want to do is here: http://www.elyrics.net/

I know that I need to use 'exposed filters' in Views and output that into a block (or something), but I haven't been able to find anything outlining each step.

I've done a lot of looking around but haven't been able to find any good (and clear) tutorials. The Views tutorials/videos I found don't seem to cover this.

Any help would be incredibly awesome! Totally frustrating to hit a road block.

Thanks.

Comments

alakesh’s picture

Use taxonomy. In views, take filter as taxonomy-there you can find a drop-down option for exposed filter.

jaggga’s picture

ahh ok. I was trying to filter by content type but I guess that's not possible.

I will give taxonomy a try, thanks!

WorldFallz’s picture

Sure you can-- just add the "Node: Type" filter, click the 'expose' button, and set the options as desired.

jaggga’s picture

Hi, thanks again for the help. I've been able to filter the taxonomy terms and expose the filters, but one thing is missing - the terms don't display when you click the drop down.

I know it's probably very simple... but any ideas of how to fix this? I've been messing with the options in Views but can't figure it out.

Do I need to add an HTML output?
Is it something with the 'replacement patterns'?

jaggga’s picture

also, there's no place to enter any text...

alakesh’s picture

I guess you have not create any taxonomy term, hence you are not able to see any terms in drop down list.
First add a vocabulary, then add terms as artist, album, song. Configure these terms to its corresponding content types.
Hope this will help..

WorldFallz’s picture

True-- but my point above is that you don't need to create an unnecessary vocabulary with redundant info. You absolutely can create an exposed filter based on node type.

jaggga’s picture

So it seems like I have two options to filter by - terms within a vocabulary, or node content type. I think I'll be able to figure it out after messing around for a bit.

I think what's still unclear is how the drop down list functions as a search. When I preview my View, I see the drop-down and an 'apply' button. How do I include a text box for users to enter text to search?

And thank you again!
Joe

WorldFallz’s picture

You can actually 'expose' any filter available in the views filter settings. To expose a textbox for search words, add the "Search: Search terms" filter and expose it.

vako’s picture

Aren't there any samples or detailed examples of how to create a scenario like this?
Taxonomy being such a strong feature in Drupal, we should see more in-dept video-tutorials and fully functional samples.

sylvie_n’s picture

If you want to have a search block, and then the results of this search to show on a page:
you need to
1). create a page view with the exposed filters set as described above
2). set "Exposed form in block:" in the basic settings of this page view to "Yes"
3). Enable the exposed form block in admin/build/block

cancerian7’s picture

Thanks.

jumoke’s picture

Good stuff