diff options
| -rwxr-xr-x | LibertyTag.php | 41 | ||||
| -rw-r--r-- | templates/header_inc.tpl | 2 |
2 files changed, 23 insertions, 20 deletions
diff --git a/LibertyTag.php b/LibertyTag.php index c88c19f..bb7b8ed 100755 --- a/LibertyTag.php +++ b/LibertyTag.php @@ -304,26 +304,29 @@ class LibertyTag extends LibertyBase { $popcant[$key] = $row['popcant']; $orderedcant[$key] = $row['popcant']; } - - //get highest count and get lowest count - sort($orderedcant); - $lowcant = $orderedcant[0]; - $highcant = $orderedcant[ (count($orderedcant) - 1) ]; - //rescore - //1. High-low = x - $cantoffset = $highcant - $lowcant; - //2. ratio 9/x - if ($cantoffset > 9){ - $tagscale = 9/$cantoffset; - }else{ - //@todo make this more sophisticated if the spread is not big enough - $tagscale = 9/$cantoffset; - } - //3. (n - low)*ratio (# to be scaled) - foreach ($ret as $key => $row) { - $ret[$key]['tagscale'] = round( (($row['popcant'] - $lowcant) * $tagscale),0); - } + //this part creates the tag weight in a scale of 1-10 + //get highest count and get lowest count + sort($orderedcant); + + $lowcant = $orderedcant[0]; + $highcant = $orderedcant[ (count($orderedcant) - 1) ]; + + //rescore + //1. High-low = x + $cantoffset = $highcant - $lowcant; + + //2. ratio 10/x + if ($cantoffset > 9){ + $tagscale = 9/$cantoffset; + }else{ + //@todo make this more sophisticated if the spread is not big enough + $tagscale = 9/$cantoffset; + } + //3. (n - low+1)*ratio (n is # to be scaled) + foreach ($ret as $key => $row) { + $ret[$key]['tagscale'] = round((($row['popcant'] - $lowcant) * $tagscale) + 1, 0); + } //if the user has asked to sort the tags by use we sort the array before returning it if ( isset($_REQUEST['sort']) && $_REQUEST['sort']=='mostpopular' ) { diff --git a/templates/header_inc.tpl b/templates/header_inc.tpl index 98046d0..0fb240f 100644 --- a/templates/header_inc.tpl +++ b/templates/header_inc.tpl @@ -3,7 +3,7 @@ {* {include file="bitpackage:tags/tags_css.tpl"} *} {literal} #cloud { margin: 0; padding: 0; } - #cloud li { display: inline; margin-right: 1em;} + #cloud li { display: inline; margin-right: .6em;} #cloud .tag1 a{ font-size: 0.7em; font-weight: 100; } #cloud .tag2 a{ font-size: 0.8em; font-weight: 200; } #cloud .tag3 a{ font-size: 0.9em; font-weight: 300; } |
