Advertising sustains the DA. Ads are hidden for members. Join today

Tagadelic Snippet

Last updated on
30 April 2025

You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules

Here's a snippet I've been using under 5.1.

It combines terms from 3 vocabularies. You'll have to change the code accordingly. I hope this is useful.

$tagcloud = "";
drupal_set_html_head('<style type="text/css">@import url('.drupal_get_path('module','tagadelic').'/tagadelic.css);</style>');
$vocs= array(4,5,410); //  ids of vocabs for which you want to build a tag cloud
$tagcloud = theme('tagadelic_weighted',tagadelic_sort_tags(tagadelic_get_weighted_tags($vocs)));
print $tagcloud;

tagadelic_get_weighted_tags() also takes the arguments steps (default of 6) and size (default of 60), in case the defaults are too much for you.

So if you wanted to show only 10 tags perhaps in a sidebar block you would add the parameter $size = 10
like so below:

$tagcloud = "";
drupal_set_html_head('<style type="text/css">@import url('.drupal_get_path('module','tagadelic').'/tagadelic.css);</style>');
$vocs= array(4,5,410); //  ids of vocabs for which you want to build a tag cloud
$tagcloud = theme('tagadelic_weighted',tagadelic_sort_tags(tagadelic_get_weighted_tags($vocs, $steps = 6, $size = 10)));
print $tagcloud;

Help improve this page

Page status: Not set

You can: