How not to use' "Taxonomy: Term ID (with depth)" Argument

I could write a tutorial on how to use Views' two most nefarious arguments, "Taxonomy: Term ID (with depth)" and "Taxonomy: Term ID depth modifier," but I won't. There are plenty of those. Instead, I'll just tell you how not to use them.

If you're like me, you'll get very excited when you see a URL that looks like http://www.mywebsite.com/taxonomy/term1-name/term2-name. It will fool you into thinking that you can create a view which accepts infinite taxonomy term arguments, each separated with a pretty slash. Well you can't. At least, not exactly.

That tricky little URL is actually just an automated path alias that has been generated by pathauto. It's actually being translated to http://www.mywebsite.com/taxonomy/tid before it makes its way into views.

In truth, you can only create views that accept taxonomy terms in the following formats:

  • /taxonomy/term/1,2
  • /taxonomy/term/1+2
  • /taxonomy/term/1/depth
  • /taxonomy/term/term-name

For more detail, see http://www.jaharmi.com/2007/09/18/drupal_taxonomy_url_tricks

Views lets you use multiple term arguments, as long as you separate them with "," or "+". You can also use taxonomy term names, which is particularly easy when you use the "transform spaces to dashes" feature. But watch out! It won't work with any punctuation that is considered a special character.

The "Taxonomy: Term ID depth modifier" lets you specify the depth, as an argument, to which the view with traverse the taxonomy vocabulary's tree. It doesn't let you keep adding arguments to the view in the form of http://www.mywebsite.com/taxonomy/term1-name/term2-name.

From what I've seen, the AND (taxonomy/term/1+2) does not work. Views itself says an AND will work as an OR because it would require too many JOINS.

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.