option to show node count instead of term count

joncup - July 4, 2008 - 04:53
Project:Tinytax taxonomy block
Version:5.x-1.9
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Just a thought here, I think it would be more useful to show the node count instead of the term count. If thats not for every one, maybe it could be an option to choose to display the node count instead.

#1

sdrycroft - July 4, 2008 - 13:35

The problem with displaying node counts is that it can be a huge performance hit.

Personally, we wanted to be able to show the number of nodes tagged with a term, or the descendants of that term.

node 1 - tagged with Dogs, node 2 is tagged with Felix and node 3 is tagged with Fido

Dogs (2)
--Rex
--Fido (1)
Cats (1)
--Felix (1)
--Foofles

It would be easy from the above figures to show the following:

Dogs (1)
--Rex
--Fido (1)
Cats
--Felix (1)
--Foofles

I may well add the ability to have the second version of the above shown, and if the Taxonomy Nested Set module is installed the first version can probably be shown.

#2

joncup - July 4, 2008 - 17:30

Option 1 makes more sense to me. In my use of taxonomy, i have 2 node types, node type a, gets Dog and Fido, but node type b gets only Fido, node type b is used as a sort of informational node, and shouldn't really be counted in taxonomy counts. Node type a has both terms, so option 1 would work great. Since node type b only has 1 node per second level term, the node counts having an extra count is a problem I could either live with or work around, but it does make this a little more complicated, some people might want to exclude or include certain node types from the count.

As far as performance goes, have you thought about caching the block and using hook_taxonomy and hook_node to update it. In this manner, the wouldn't be a performance hit every time you view the block, and depending on how you implement things, ie just update the block instead of regenerating it, it wouldn't be a big hit when adding and viewing terms or nodes either. I don't know if this would work, or if this would require a major rewrite of the module, just wanted to hear your thoughts.

 
 

Drupal is a registered trademark of Dries Buytaert.