diff options
author | Brion Vibber <brion@status.net> | 2010-01-04 10:39:11 -0800 |
---|---|---|
committer | Brion Vibber <brion@status.net> | 2010-01-04 10:39:11 -0800 |
commit | 11d7365a15bb8c8cb856bf0d545a0b550f3dbe26 (patch) | |
tree | 4ee27627df1ea59d7dca0e572ebae8e9ede1ca2c | |
parent | 783a2e249bac2ccd02b6ae3351dfe83630b71cc0 (diff) |
Don't spew notices when building tag cloud if there is no popularity sum to divide by.
-rw-r--r-- | actions/publictagcloud.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actions/publictagcloud.php b/actions/publictagcloud.php index e7f6ee36c..5c7074029 100644 --- a/actions/publictagcloud.php +++ b/actions/publictagcloud.php @@ -136,7 +136,12 @@ class PublictagcloudAction extends Action $this->elementStart('dd'); $this->elementStart('ul', 'tags xoxo tag-cloud'); foreach ($tw as $tag => $weight) { - $this->showTag($tag, $weight, $weight/$sum); + if ($sum) { + $weightedSum = $weight/$sum; + } else { + $weightedSum = 1; + } + $this->showTag($tag, $weight, $weightedSum); } $this->elementEnd('ul'); $this->elementEnd('dd'); |