Flowcharts for Drupal Tag Clouds

kentbye's picture
| |

I came up with three different flowcharts for creating different types of tag clouds in Drupal -- each one increases in flexibility and complexity.

Basic Tag Cloud
Personalized Tag Cloud
Tag Cloud Based Upon Identity


I briefly explain them below and in more detail soon...

The first tag cloud flowchart is the simplest version for creating a tag cloud from all vocabulary terms. The tagadelic module is actually a bit more sophisticated than this basic flowchart since it only selects the free-tagging taxonomy terms.


Basic Tag Cloud

The difference is that I'm adding a different font distribution algorithm that I explain more in detail here.

This first chart also shows in simplest terms the most important data for creating a tag cloud -- counting the number of times each term tid appears in the nodes via term_node and correlating the term tid with the term name via term_data.

The second tag cloud chart adds another layer of complexity by showing what it would take to create a personalized tag cloud by inputting the desired user and desired category vocabulary.

Personalized Tag Cloud

My intent was to make it possible for each Drupal user to be able to have their own Personal Tag Cloud that could be viewed as a block.

UPDATE: Here is the Drupal code for creating a personalized list of tags ordered by frequency with uniform font sizes. I pasted this into a block that appears as the bottom block on the left-hand column.

$vocabulary_id = 4;
$username = $user->uid;
$result = db_query("SELECT d.tid, d.name, MAX(n.created) AS updated, COUNT(*) AS count FROM {term_data} d INNER JOIN {term_node} USING (tid) INNER JOIN {node} n USING (nid) WHERE d.vid = $vocabulary_id AND n.uid = $username AND n.status = 1 GROUP BY d.tid, d.name ORDER BY count DESC, d.name");
$items = array();
while ($category = db_fetch_object($result)) {
  $items[] = l($category->name .' ('. $category->count .')', 'taxonomy/term/'. $category->tid);
}
print theme('item_list', $items);

The tags from other users are filter out by correlating the selected user's uid with their authored node nids via the node table.

The selected category vocabularies are filtered by correlating the vocabulary vid with the term tid via the term_data table.

Finally, the third tag cloud flowchart shows how to create tag clouds based upon some declared user profile identity. In my case, I hope to show different tag clouds split up from the tags submitted from users who opposed the military intervention in Iraq and users who supported it.

Tag Cloud Based Upon Identity


This is analogous to the previous flowchart except that the users would be filtered according to the user profile values selected from the possible options.

I'll specify more details of the boxes soon, but I just wanted to post the progress that I've made on this over the last week of thinking about it.