I think many of you saw great plugin for tag cloud in Wordpress called WP-Cumulus by Roy Tanck. As i prefer Drupal for blogging, i searched for the implementation of this plugin in Drupal, and voila, one of the Drupal.ru members wincert already done it. So i'll do here a little bit of translation and examples from his great work.
At first you'll need tagadelicmodule. Without it you'll have a regular tag cloud. That's not what you want, eh?
Then you'll need two files: SWF and JS. This files are on a wincert's blog. Place them in your theme, or anywhere you want (but don't forget to change the paths in the small script below)
Insert this snippet into a page or block, or anywhere you want:
<?php
// Id of needed vocabulary
$slovar = "1";
// Query for tags
$query = "SELECT DISTINCT t.name, t.tid FROM {term_data} t WHERE t.vid = $slovar";
// Query result
$sql = db_rewrite_sql($query);
$result = db_query($sql);
// Forming tags for the plugin
$ftags = "<tags>";
while ($node = db_fetch_object($result)) {
$ftags .= '<a href="/taxonomy/term/'.$node-> tid.'" style="font-size: 10pt">'.$node-> name.'</a>';
}
$ftags .= "</tags>";
// Retrieve tags from tagadelic for user who disabled JS in browser or don't have a flash player
$vocs = array(1); // Vocabulary ids array
$tags = tagadelic_get_weighted_tags($vocs, 6, 20);
$tags = tagadelic_sort_tags($tags);
$output = theme('tagadelic_weighted', $tags);
echo '<div id="tags">
'. $output .'
<script type="text/javascript" src="'. base_path() . path_to_theme() .'/swfobject.js"></script>
<script type="text/javascript">
var rnumber = Math.floor(Math.random()*9999999);
var widget_so = new SWFObject("'. base_path() . path_to_theme() .'/tagcloud.swf?r="+rnumber, "tagcloudflash", "230", "170", "9", "#ffffff");
widget_so.addParam("allowScriptAccess", "always");
widget_so.addVariable("tcolor", "0x333333");
widget_so.addVariable("tspeed", "220");
widget_so.addVariable("distr", "true");
widget_so.addVariable("mode", "tags");
widget_so.addVariable("tagcloud", "'.urlencode($ftags).'");
widget_so.write("tags");
</script>
</div>';
?>I didn't went deep in the parameters of plugin, just changed body color (#ffffff in example above) and text color (0x333333 in example above). I'm sure if you want to customize it more you will find what to do. If not, just ask here in comments, i will try to help you!
That's all! You can see the result of plugin work in a block on my blog, i'm sure you've already played with it ;)









Re: How to setup WP-Cumulus in Drupal
Hi there,
we've discussed a solution on http://drupal.org/node/290417. Based on your post we've created a module which requires Tagadelic. Also lut4rp has created a module page. Check it out on http://drupal.org/project/cumulus.
Thanks for your translation and all the work you had, Bjoern.
Re: How to setup WP-Cumulus in Drupal
No problem, guys! I wih i had time to do this module by myself. If you need any help, just add me to cvs access (you can find my drupal profile link on about page) and ping me.
Post new comment