Add counting fields to views integration
Boris Mann - October 21, 2006 - 01:43
| Project: | Community Tags |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
Suggested data fields:
* Community Tags: Tag count - total # of tags per node (sort by most tagged
* Community Tags: Tags - the N most popular tags for that node, with N as a drop down argument
* Community Tags: UID Tags - tags for a particular user (i.e. my tags)
Hmmmm...what if "tag cloud" where actually a view, just like gmap is a view?

#1
Cool. I've never done any Views integration, but no time like the present to start, I guess. ;)
"Tag cloud" as a View sounds very cool. I'm trying to wrap my head around how to use Views stuff (i.e. fields, arguments, sort options) to pull this off. It seems kind of tricky because we're no longer talking about the node itself, but rather some attributes about the node (terms).
#2
Voting works like this, too. I would look at it as the best guide.
#3
I definitely agree this feature needs to be implemented, however I'm going to postpone it for now. If someone wants to pick it up, please be my guest! :D Otherwise, I'll get to it eventually. I owe merlin some Views docs anyway. :)
#4
Here's a start: include this file and it'll let you create a view that gets a user ID as an argument (from the URL) and shows a table of all nodes tagged by that user, along with their tags. There's an option to display weighted or plain tags, but using weighted tags will probably be really expensive if there are lots of nodes; it'll be weighted for overall usage as well, not per user.
There's a nasty hack in there that should be fixed - I couldn't work out how to get the user ID from the argument into the field handler, hence the global variable...
#5
Awesome, thanks! I have no idea when I'll have a chance to look at this, but for now marking it as a patch (code needs review) so it hopefully gets some other eyeballs on it. :)
#6
Bump. I am thinking webchick now has some views integration experience :)
#7
But she no longer maintains this module. ;)
#8
Anyone port this to 6.x ?
#9
There is a views integration patch over here: http://drupal.org/node/246327
However it only addresses point 3.
1 and 2 will be much more difficult because it requires some form of counting. I believe some modules do this by keeping a seperate count table such as Flag. Perhaps a better solution is to wait till views 3.x supports counting. Or I suppose it would be possible to write a complicated views handler.
#10
views integration has been committed to 6.x. So I am changing title to be more specific.
Some ideas:
# of times tag has been used
# of nodes with tag
# of time node has been tagged with each tag (e.g. 20 users tags node 1 with the tag "awesome")
All of these would want to be filterable by user, e.g. # of times tag has been used by User2
I have not thoroughly thought through if and how this might be possible. I know Views 3 is looking to add grouping (which will hopefully support counting).