port to Drupal 6
jrglasgow - September 26, 2008 - 22:14
| Project: | Search Cloud Generator |
| Version: | 5.x-7.1-1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
are there any plans to port this to Drupal 6?

#1
here is my work porting to D6 - is you need help... I am willing to help as a co-maintainer
#2
Thank you, it works for me fine.
I have added the theme function.
$block['content'] = $tag_cloud->getCloud();replace with
$block['content'] = theme('searchcloud_box',$tag_cloud->getCloud());added 2 function
function searchcloud_theme() {
return array(
'searchcloud_box' => array(
'arguments' => array('getCloud')
),
);
}
function theme_searchcloud_box($getCloud) {
return $getCloud;
}
#3
And here is the patch file.
#4
how to instal this D6 patch?
i must download a d5 version serch cloud than patch it or how?
Thx.. completely noobs..
or you can upload it as an full tar.gz file :D
#5
The instruction to apply patches can be found under http://drupal.org/patch/apply.
#6
error on install, but works well. than..
got this error:
warning: Division by zero in /home/***/***.com/modules/searchcloud/classes/tagCloud.class.php on line 98.#7
Last month, I created a port for searchcloud to D6, but neglected to upload the patch here (sorry). It works in D6, including the block, but I can't get it to work with the theme patch in #3.
I don't remember what exactly fixed the 'Division by zero' error, but I remember encountering that same error as adr1st in #6. Maybe with a little work, the theme function patch can be incorporated?
Bryan O'Shea
Obsidian Design
#8
The theme patch dont effect the install function.
#9
Hi,
/subscribe, would be cool to see an official support of the 6.x version of drupal.
#10
the "Divide by Zero" happens when all terms have the same number of search hits which then breaks the "maxcount - mincount" part of the calculation in Line 98 where it tries to determine the font size. What I did was a few lines before that when you actually calculate the Min and Max, I just calculated the DeltaCount there and made sure that it was at least 1. Then just use the DeltaCount in the formula instead of calculating it each time. The Delta will not change while looping the terms anyway.
I don't know how to make a patch but here is the code snippets to change in tagCloud.class.php:
<?phpprivate $_iMinCount;
private $_iMaxCount;
+ private $_iDeltaCount;
private $_sFinalHtmlCloud;
private $_iMinimumTagLength;
?>
and
<?php$this->_iMinCount = $this->_aTermsCounts[0];
$this->_iMaxCount = $this->_aTermsCounts[count($this->_aTermsCounts)-1];
+ $this->_iDeltaCount = $this->_iMaxCount-$this->_iMinCount;
+ $this->_iDeltaCount = ($this->_iDeltaCount?$this->_iDeltaCount:1);
// apply the formula for each term:
for ($i=0; $i<count($this->_aTerms); $i++) {
if (count($this->_aTerms) > 1) {
- $this->_aTerms[$i]['font_size'] = intval(((($this->_aTerms[$i]['count']-$this->_iMinCount)*($this->_iMaxFontSize-$this->_iMinFontSize))/($this->_iMaxCount-$this->_iMinCount))+$this->_iMinFontSize);
+ $this->_aTerms[$i]['font_size'] = intval(((($this->_aTerms[$i]['count']-$this->_iMinCount)*($this->_iMaxFontSize-$this->_iMinFontSize))/($this->_iDeltaCount))+$this->_iMinFontSize);
}
else {
?>
This module (and D6 patch) work awesome. thnx
#11
Hello, I tried to patch the package for drupal 5.
the install work, but the link in admin menu disappear.
Can somebody share the full working D6 package ? Here or in list modules, as you want.
Thx :)
#12
Good work. Is this patched version stable?
#13
Please if this is work made a -dev package.
How can we adopt the module from spinicrus to somebody who want to do this? :\
Bye