Search This Blog

Loading...

Sunday, December 25, 2011

Tagadelic Snippet

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.
<?php
$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:
<?php
$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;?>

0 comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails