Hello,

My website has a collection of articles classified with the taxonomy (I have articles on php, css, webdesign, etc.).
The menu of my website looks like this (I've included the paths in parenthesis):

Articles                    (articles)
-- Server-side Programming  (articles/60)
---- PHP                    (articles/60/128)
---- ASP                    (articles/60/129)
-- WebDesign                (articles/73)
---- Photoshop              (articles/73/112)
---- CSS                    (articles/73/114)

I'd like to use a view with the path "articles" and arguments to generate all the appropriate pages/subpages, and I'd like it to work as follows:

  • articles ==> show Header Text only, no nodes.
  • articles/60 ==> show all nodes attached to term ID 60 plus its children (the equivalent of taxonomy/term/60/all) ; in my example, it means showing 60 + 128 + 129.
  • articles/60/128 ==> show all nodes attached to term ID 128 (and nothing else)

I've tried multiple view setups (with one argument, two arguments), I've tried to manually tweak my args with the Argument Handling Code, but I can't get it to work... I'd like to use a single view for this because that's essentially what it is (a single view), and I need to keep my path structure as it is because it enables Drupal to display my menu is a neat tree structure.

Any help greatly appreciated. Thanks.

Comments

vincentc’s picture

Reading the handbook more carefully gave me the answer!!

Add two arguments to the view:

  • Taxonomy:Term ID with Default = "Use Empty Text" and Option = 1 (that was the trick!!)
  • Taxonomy:Term ID with Default = "Display All Values"

No Argument Handling Code!!
Once again, I'm amazed by the simplicity and the power of Views!!!

ajayg’s picture

Thanks for sharing. I was looking something very similar. So did you create two seperate views or just one view with both conditions?

valderama’s picture

hello!

i using taxonomy module, and for each primary link i have a term. i want to have a submenu which displayes a list of all node in this term. i have defined a view, but i don't know which arguments or filters i need.

i think it might be quite simple - so can you help me?

thanks in advance!

best greetings, walter

please visit http://jam07.imperium-gastunum.com/drupal/ if you don't understand my description of the situation. i want a submenu on the right sidebar, including all stories from the current term.

--

keine zeit für spielkonsolen mein leben ist jump n run!

valderama.net

funkyhat’s picture

I'm trying to do the same thing as this only using Taxonomy: Term Name

Is that possible at all?

babbage’s picture

I couldn't get the above to work. In any case, it turned out there was a simpler solution—just set a single argument of "Taxonomy: Term ID (with depth)". Then, to display all child terms up to 10 levels deep, set the depth to 10 (the maximum). If you wish to display only content tagged to the parent term and direct children (i.e. not grandchildren) set the depth to 1 and so on.

Easy.

travist’s picture

You can also try the module, Easyfilter. This makes it so that you can specify either the ID OR the term name as an argument, and they can be in any order...

This module is not as powerful as Views, but I wrote it because I wanted something that Views did not provide.

Here is the link.

www.drupal.org/project/easyfilter

Let me know what you think...

vincentc’s picture

@ajayg

I ended up creating a single view both conditions.

@valderama

You could use the view taxonomy/term (it's provided by default with the views module, you just need to activate it). Then, have each of your primary links point to URLs like "taxonomy/term/1", "taxonomy/term/2"... where 1, 2... are your term IDs.
Finally, you may want to create URL aliases like "taxonomy/term/1" <=> "partners".

@travis

Very nice module that you designed, but I don't see how it does things that Views can't do already.

------------
Web Developer in Lille, France
Création de sites Web Drupal - Tutoriels Drupal - Formation Drupal