Intelligent display of multi-level taxonomy

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
kerberos's picture

Hello everyone.

I am trying to solve the following problem and am wondering if I overlooked anything:

I am working on a listings directory. I'm creating a content type with CCK and want to use taxonomy to organize the different categories. The structure would be something akin to:

Directory Vocabulary
-- Business Category 1
---- Subterm 1
------ Sub-sub term 1
------ Sub-sub term 2
------ Sub-sub term 3
---- Subterm 2
------ Subterm 3
-- Business Category 2
-- Business Category 3
...

The actual nodes with content would be at the outermost leaves of this tree only. I am looking for a good way to display this. On the main page, I just want a listing of the level 1 Vocabulary Terms (Business Category X). If someone clicks on one of those level 1 terms, I want the next page to be a listing of the child sub-terms (Subterm 1-n for Business Category X) rather than the nodes that were tagged with Business Category X. Then, if you click the subterm 1-n on the second page, it would go to a page that lists just the sub-sub terms (if they exist for this term). At the very end of this hierarchy, when the user clicks on a taxonomy term that has no child terms but only nodes that are tagged with it, I want the actual list of nodes to be displayed as normally happens with taxonomy. I tried to use Views to create this, but it just shows the tagged nodes rather than child taxonomy terms.

I also found a few contrib modules such as Taxonomy Browser or Taxonomy List, but they seem to just show the entire hierarchy on one page rather than distributed over several linked pages. I was wondering if anyone had some pointers on how this might be achieved. Most Drupal based directories that I saw only have a main and one sub-level, I wonder if they chose that because of this limitation.

As an alternative, I was considering having the entire taxonomy tree on one page (like Taxonomy List) but then use some type of collapsible field set or AJAX to collapse the terms until they are expanded by the user, revealing the sub-terms. Has anyone attempted something like that or know of any pre-existing solutions?

Many thanks for any pointers.

-Daniel

Comments

Vocabluary Index does

Xano's picture

Vocabluary Index does exactly what you need. You can let users browse through taxonomy in different ways. Both ways you are talking about (actually browsing and the collapsible tree) are possible.

Thanks a lot!

kerberos's picture

Yes, this is exactly what I was looking for. Thank you very much for bringing it to my attention and for creating such a useful module. Would you say it is ready for a production environment on D6? Are you still available for customizations of the module?

-Daniel

I'd say it is. I haven't had

Xano's picture

I'd say it is. I haven't had any bug reports for a while and the only bug report that is still open looks like a PHP4 incompatibility. If I don't get new bug reports in the next two weeks I'll release the final version.

Access nodes?

michaelfillier's picture

I installed this but I am unable to access the actual nodes.

I am trying to put together a business directory (seems like a lot of people are) so I have created a vocabulary for the categories "Business Categories", eg:

Automotive Services
~ Brake Services
~ Window Repair
Food & Beverage
~ Bakery
~ Restaurant
- Italian Restaurant
- Indian Restaurant

I have created a new content type "business" and I use the Content Taxonomy module to add taxonomy to the "business" nodes (Is there a better way to tag CCK with taxonomy?).

I have installed the Vocabulary Index Module and activated it for my Business Categories vocab and turned on the "count" feature. I can browse the taxonomy fields but they all display (0) and when I reach the end it turns up empty. What am I doing wrong?

Thanks,

Michael

UPDATE: Followed the same method with a story vocabulary and this is working perfect, is this a problem with cck content type or am I taggin my "businesses" wrong?

--
Gimme' a break I'm learning here!

Got it!

michaelfillier's picture

Just wanted to update the post in case another is having a similar problem as me. You need to make sure your cck taxonomy is being stored in the core taxonomy table by checking the option for the field:

"Save values additionally to the core taxonomy system (into the 'term_node' table).
If this option is set, saving of terms is additionally handled by the taxonomy module. So saved terms from Content Taxonomy fields will appear as any other terms saved by the core taxonomy module. Set this option if you are using any other taxonomy application, like tagadelic. Otherwise terms are only saved in the cck tables and can only be accessed via the node or a view"

Kudos for creating such a simple and effective module, its working great right now and has brought me one step closer to completion.

Gimme' a break I'm learning here!

We built a module that does something like this

GripMediaDOTNet's picture

Vocabulary index is a good solution.

Ours is simpler, but really kinda cool and does it all with blocks.

Hit me up if you want me to send it to you. We are going to release it in March to Drupal as a whole...

=gripmedia.net

Cross-Vocabulary taxonomy browsing

mojo78's picture

Hi,
Has anyone implemented a method for having one vocabulary as a top-level for a directory and as you click on terms within this top level, you get a list of terms from a different vocabulary?

That sounds like an odd requirement and here's how it arose; we want each node within our directory to be classified according to a controlled, top-level vocabulary (say 'Travel' or 'Construction'), with a free-tagging vocabulary used to apply sub-category terms.

On the landing page, you can click one of the top-level terms, T, and get a list of sub-category terms that are associated with nodes tagged with T. Clicking on these sub category terms would retrieve a list of nodes tagged with T and the sub category term.

Does this sound like a feasible scenario or should we go back to the drawing board?

Thanks,
Maurice

rbgrn's picture

I was facing a similar problem so I did this - http://www.rbgrn.net/diy/content/194-drupal-taxonomy-how-to-add-list-cli...

It makes it so that if you navigate to my topic "Programming", you will get all programming content and under the taxonomy term description there are links to child terms. This works with any depth.