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

jrglasgow - September 27, 2008 - 00:46
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

LEalex - December 3, 2008 - 14:28

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

LEalex - December 3, 2008 - 14:42

And here is the patch file.

AttachmentSize
searchcloud_theme.patch 1.48 KB

#4

adr1st - December 4, 2008 - 19:20

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

LEalex - December 4, 2008 - 22:38

The instruction to apply patches can be found under http://drupal.org/patch/apply.

AttachmentSize
searchcloud.tar_.gz 9.79 KB

#6

adr1st - December 6, 2008 - 16:48

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

obsidiandesign - December 21, 2008 - 00:11

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

LEalex - January 13, 2009 - 08:52

The theme patch dont effect the install function.

#9

zmove - January 24, 2009 - 16:44

Hi,

/subscribe, would be cool to see an official support of the 6.x version of drupal.

#10

jack.r.abbit - April 29, 2009 - 17:05

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

CloneVince - May 27, 2009 - 14:58

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

perandre - September 26, 2009 - 16:08

Good work. Is this patched version stable?

#13

lazly - October 29, 2009 - 13:42

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

 
 

Drupal is a registered trademark of Dries Buytaert.