Introduction
Long ago, when I was playing around with the Views Module, I had one goal in mind. To create an easy filter system where I can search my content based on Taxonomy Terms. What I wanted to do was just create a URL filtering system where the user can just put in a URL, and then any other commands after this would then be used as a filter. With my early attempts to create this functionality using the Views Module, I became very frustrated. So what does any normal geek do when he is frustrated with software??? He writes his own!!
So, that's why I created the EasyFilter. It gave me an interface to filter my content based off of Taxonomy terms. Well, just very recently, I started playing around with the Views module again, and was surprised that due to the advancements in module, you can actually create the same EasyFilter effect with the Views module. Well, unlike most software writers. I will accept defeat to the Views Module. I have decided to discontinue the EasyFilter module. But to those 3 people out there who are actually using this module, please don't fret! I am writing this tutorial to show you how you can create the same functionality with the Views module like what I did in my Videos Section. You see... I'm not leaving you hangin!
Views Module Installation
Here is how I constructed my Video Section using the Views Module. The first thing that you will need to do is actually go to the Drupal website and get the Views Module. Once you have this module, you will then need to install and enable it in your Drupal system (I am assuming that everyone knows how to do this already). So now you are ready to go. The first thing that you will need to do is create a new content type using the CCK module called video. If you don't know how to do this, then I go over it in my FlashVideo Tutorial (which is my most popular tutorial, so check it out!).
Create some Categories
Once you have this node type created, you will then need to add some categories describing your new Video node type. For many newcomers to Drupal, the whole Taxonomy / Category thing can be VERY intimidating. Just to help clarify things a little better, you can actually use Taxonomy and Category interchangeably, meaning that Taxonomy is just a fancy word Category. So, lets create some categories for our Video node type. Go to Administer >> Content Management >> Categories. Once you are there, you will then need to click on the tab that says Add Category. This will then ask you to type in a Name for your category. This is really asking you the question "How would you like to group your videos?" For me, I wanted to created to Group my videos in Categories of Comedy, Commercials, Gross, etc... So for the name of my vocabulary, I just typed Category. You will then need to check the checkbox next to your newly created Video node type, and then click on Disabled under Heigharchy, and then click Submit. You now need to add terms to this Category... this is pretty self explanatory. Next to the listing of the Category items, you can click on Add Terms. Here you will add a Term for Comedy, another term for Commercials, and another for Gross, etc. until you have all the terms you want inside the Category. Let's move on!
Views Module Setup
Ok, so now we are ready to set up our view to mimic the EasyFilter. First start by going to the Views setup page. You get there by going to Administer >> Site Building >> Views. Once you are there, you will need to add a new view. Let's call our new view Videos (plural since it will be a view of a lot of videos). You do this by just clicking on the Add tab. This is where Views intimidates the HECK out of newcomers. There are about a thousand different parameters to enter to describe your view... so lets just walk through this one step by step.
- Type Videos in the Name texbox
- Type a small description in the Description textbox. I just put A view of all my videos
- Expand the Page section, and check the box that says Provide a Page View
- For the URL, I just type videos... meaning that this view will kick in at the url http://www.travistidwell.com/videos
- Select Teaser List under the View Type drop-down box.
Ok, so now here is where it gets a little tricky. We need to do some filter magic to create the same functionality of the EasyFilter. So we will spend the rest of our time in the Filter Section of the Views Setup page.
- The first thing we will want to do is filter all other nodes EXCEPT our videos. We don't want to be bringing in some other content besides videos in our Videos section. To do this, under the drop-down box that says Add Filter, we will want to select the one that says Node: Type and then click on Add Filter.
- This will bring up some other operations. Make sure the Operator says Is One Of and that you select Video as your Value
- Ok, now lets expose those Categories for our videos. Again, under the Add Filter section, select the item that says Taxonomy: Terms for Video Category. Once this gets added to the filter list, we will then want to make sure that the Operator says Is all of.
- Now do the same thing as above, but this time with the Taxonomy: Terms for Video Rating.
- Now we will want to Expose both the Taxonomy: Terms for Video Category and the Taxonomy: Terms for Video Rating. You do this by just clicking on the button that says Expose next to them. NOTE: You only need to click this button once. You probably won't see any result from clicking them, but trust me, when you do, you have added them as an exposed filter.
- Now, lets go down into the Exposed Filters section. Do you see your two Taxonomy filters? Good! We now almost there!
- For each of the Exposed Filters, we will want to create labels for each one. Just type Category and Rating.
- Now we will want to check the checkboxes that say Optional and Lock Operation for both of these Exposed Filters
- Now for the moment of truth!!! Click on the Save Button. Now go to the URL http://www.travistidwell.com/videos. Did it work!??? Oh God, I hope so!
After playing around with the Views module, I really got an idea of how powerful this module really is. My EasyFilter just got its ass kicked by it, and for good reason. It is versatile, expandable, customizable, and I could go on and on! That is why I have decided to discontinue the EasyFilter module. Hopefully, this tutorial will make it to where that decision doesn't piss a lot of people off. Well, ok.... it will piss off the 3 people who are actually USING the EasyFilter, so for you 3 people out there. This ones for you!




I think
Hi, it’s wonderfull…. thanks a lot…
But I need also the menu to be collapsible and to show subterms for two levels. My vocabulary contains 10 terms that have a lot of terms a and subterms….
I can’t work without a collapsibile two level structure!
Taxonomy menu, even if a great module, has two limitation : 1)does not work with pathauto
2) I’cant handle the list of the nodes related to terms and subterms.
So, please, help me!!!!!
---
movie downloads
What About Blocks
Is there any way to get this to work with block views? I got it to work for a page view.
Thanks.
You will just need to use
You will just need to use the API calls to make it work for a Block view. Here is a sample....
<?php print flashvideo_get_video($node); ?>Is the same thing as saying [video]
Nice Tutorial
If you learn more about how to use views to do specific tasks without programming I think the non-programmer Drupal community can benifit from more tutorials like this. Views is awesome and powerful, but can be confusing. thx.
to Nice Tutorial
Ha-Ha-Ha! You are the real men's!!! ;-))