1
 -Term 1
   --Term 1 Sub 1
   --Term 1 Sub 2
     -- Term 1 Sub 2 Sub 1
     -- Term 1 Sub 2 Sub 2
 -Term 2
 --------------------
 -------------

This is my Taxonomy structure. I need to build a taxonomy list in views.

http://mydom.com/gallery/term-1 // this will list the next level of taxonomy. http://mydom.com/gallery/term-1/term-1-sub-1 // this will list the next sub level

etc like that. Can you please suggest one good way for doing this

  • can u use contexual filter? – monymirza Mar 9 '13 at 16:06
6

Install and activate the Views Tree module.

Add a new 'Taxonomy Terms' view. (Choose the vocabulary or 'All').

Add a relationship to Taxonomy Term:Parent Term. Do NOT set this relationship as required.

Add two fields for Taxonomy Term:Term ID. The first label as Main Term ID, and exclude from display. This one does not use the relationship. The second label as Pareent Term ID and exclude from display. This one Does use the relationship.

Add any other fields you wish to include (Name, Description etc) and style as you wish.

Change the view format from Unformatted List to Tree (Adjacency model), and under settings, set the Main field to Main Term ID and the Parent field to Parent Term ID.

Create a page display, give it a path, and save the view. Go to the path and look at your taxonomy tree. (The tree styling sometimes does not display in the live preview, particularly if you use Seven as an admin theme.)

  • Good explanation. But this is not set my goal. – Sibiraj PR Mar 10 '13 at 6:07
  • I re-read the question, and I guess I still don't understand what you are trying to accomplish. It appears you are trying to put a breadcrumb into your paths. You do not need to maintain the hierarchy in the path, just in the access. If you are looking at cascading views, unless you want to write separate views for each level (at the very least), the term parameter must reamin in the same position in the url. Could you explain what you are trying to accomplish in a little more detail? – Triskelion Mar 10 '13 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.