Changeset 488

Show
Ignore:
Timestamp:
05/26/05 07:10:47 (4 years ago)
Author:
mbonetti
Message:

fix: warningn when there are no tags

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/rss/tags.php

    r484 r488  
    2929############################################################################### 
    3030# $Log$ 
     31# Revision 1.29  2005/05/26 05:10:47  mbonetti 
     32# fix: warningn when there are no tags 
     33# 
    3134# Revision 1.28  2005/05/20 09:35:11  mbonetti 
    3235# 0.4.2 
     
    274277    // Credits: Matt, http://www.hitormiss.org/about/ 
    275278    // http://dev.wp-plugins.org/file/weighted-category-list/weighted_categories.php?format=txt 
    276     $spread = max($tags) - min($tags); 
    277     if ($spread <= 0) { $spread = 1; }; 
    278     $fontspread = LARGEST - SMALLEST; 
    279     $fontstep = $spread / $fontspread; 
    280     if ($fontspread <= 0) { $fontspread = 1; } 
    281     $ret = ""; 
    282     foreach ($tags as $tag => $cnt) { 
    283     $taglink = getPath() . 
    284       (getConfig('rss.output.usemodrewrite')?"tag/$tag":"tags.php?tag=$tag"); 
    285     $ret .= "\t<a href=\"$taglink\" title=\"$cnt " 
    286       .($cnt > 1 || $cnt == 0 ? ITEMS:ITEM)."\" style=\"font-size: ". 
    287       (SMALLEST + ($cnt/$fontstep)). UNIT.";\">$tag</a> \n"; 
     279    if (count($tags)) { 
     280        $spread = max($tags) - min($tags); 
     281        if ($spread <= 0) { $spread = 1; }; 
     282        $fontspread = LARGEST - SMALLEST; 
     283        $fontstep = $spread / $fontspread; 
     284        if ($fontspread <= 0) { $fontspread = 1; } 
     285        $ret = ""; 
     286        foreach ($tags as $tag => $cnt) { 
     287        $taglink = getPath() . 
     288          (getConfig('rss.output.usemodrewrite')?"tag/$tag":"tags.php?tag=$tag"); 
     289        $ret .= "\t<a href=\"$taglink\" title=\"$cnt " 
     290          .($cnt > 1 || $cnt == 0 ? ITEMS:ITEM)."\" style=\"font-size: ". 
     291          (SMALLEST + ($cnt/$fontstep)). UNIT.";\">$tag</a> \n"; 
     292        } 
     293    } else { 
     294        $ret =""; 
    288295    } 
    289296