Project:Search Cloud Generator
Version:5.x-7.1-1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

are there any plans to port this to Drupal 6?

Comments

#1

Status:active» needs review

here is my work porting to D6 - is you need help... I am willing to help as a co-maintainer

AttachmentSize
searchcloud_port_to_d6.patch 19.37 KB

#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.

AttachmentSize
searchcloud_theme.patch 1.48 KB

#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.

AttachmentSize
searchcloud.tar_.gz 9.79 KB

#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

AttachmentSize
searchcloud.d6.patch 12.94 KB

#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:

<?php
   
private $_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

#14

is it stable to use it with D6 ?

#15

Status:needs review» fixed

I've committed a patch based on #1 and #7 with some tweaks. Then committed the division by zero fix in #10.

For the theming issue at #2, I've created a new issue for it #794244 as it deserves special attentions and needs more work IMHO :)

I've created a -dev release for the D6 version, and soon a release candidate (if I get at least one positive feedback) then a release. I'm personally willing to devote the time to quickly get a release out, there are few interesting features we can get there once we get to that state.

Thanks!

#16

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.