Changeset 18455
- Timestamp:
- Oct 4, 2012, 6:15:28 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_tag.inc.php
r12922 r18455 65 65 while ($row = pwg_db_fetch_assoc($result)) 66 66 { 67 $counter = @$tag_counters[ $row['id'] ];67 $counter = intval(@$tag_counters[ $row['id'] ]); 68 68 if ( $counter ) 69 69 { 70 70 $row['counter'] = $counter; 71 71 $row['name'] = trigger_event('render_tag_name', $row['name']); 72 array_push($tags, $row);72 $tags[] = $row; 73 73 } 74 74 } … … 92 92 { 93 93 $row['name'] = trigger_event('render_tag_name', $row['name']); 94 array_push($tags, $row);94 $tags[] = $row; 95 95 } 96 96 … … 139 139 140 140 // display sorted tags 141 foreach ( array_keys($tags) as $k)142 { 143 $tag s[$k]['level'] = 1;141 foreach ($tags as &$tag) 142 { 143 $tag['level'] = 1; 144 144 145 145 // based on threshold, determine current tag level 146 146 for ($i = $conf['tags_levels'] - 1; $i >= 1; $i--) 147 147 { 148 if ($tag s[$k]['counter'] > $threshold_of_level[$i])148 if ($tag['counter'] > $threshold_of_level[$i]) 149 149 { 150 $tag s[$k]['level'] = $i + 1;150 $tag['level'] = $i + 1; 151 151 break; 152 152 } 153 153 } 154 154 } 155 unset($tag); 155 156 156 157 return $tags; … … 255 256 { 256 257 $row['name'] = trigger_event('render_tag_name', $row['name']); 257 array_push($tags, $row);258 $tags[] = $row; 258 259 } 259 260 usort($tags, 'tag_alpha_compare'); -
trunk/tags.php
r18063 r18455 160 160 } 161 161 } 162 163 // +-----------------------------------------------------------------------+ 164 // | tag cloud construction | 165 // +-----------------------------------------------------------------------+ 166 167 // we want only the first most represented tags, so we sort them by counter 168 // and take the first tags 169 usort($tags, 'counter_compare'); 170 $tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']); 171 172 // depending on its counter and the other tags counter, each tag has a level 173 $tags = add_level_to_tags($tags); 174 175 // we want tags diplayed in alphabetic order 176 if ('letters' != $page['display_mode']) 177 { 162 else 163 { 164 // +-----------------------------------------------------------------------+ 165 // | tag cloud construction | 166 // +-----------------------------------------------------------------------+ 167 168 // we want only the first most represented tags, so we sort them by counter 169 // and take the first tags 170 usort($tags, 'counter_compare'); 171 $tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']); 172 173 // depending on its counter and the other tags counter, each tag has a level 174 $tags = add_level_to_tags($tags); 175 176 // we want tags diplayed in alphabetic order 178 177 usort($tags, 'tag_alpha_compare'); 179 } 180 181 // display sorted tags 182 foreach ($tags as $tag) 183 { 184 $template->append(185 'tags',186 array_merge(187 $tag,188 array(189 'URL' => make_index_url(190 array(191 'tags' => array($tag),192 ) 193 ) ,178 179 // display sorted tags 180 foreach ($tags as $tag) 181 { 182 $template->append( 183 'tags', 184 array_merge( 185 $tag, 186 array( 187 'URL' => make_index_url( 188 array( 189 'tags' => array($tag), 190 ) 191 ), 192 ) 194 193 ) 195 ) 196 ); 197 } 198 194 ); 195 } 196 } 199 197 // include menubar 200 198 $themeconf = $template->get_template_vars('themeconf'); -
trunk/themes/default/template/tags.tpl
r14240 r18455 20 20 {include file='infos_errors.tpl'} 21 21 22 {if isset($tags)} 23 {if $display_mode == 'cloud'} 24 <div id="fullTagCloud"> 25 {foreach from=$tags item=tag} 26 <span><a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)}">{$tag.name}</a></span> 22 23 {if $display_mode == 'cloud' and isset($tags)} 24 <div id="fullTagCloud"> 25 {foreach from=$tags item=tag} 26 <span><a href="{$tag.URL}" class="tagLevel{$tag.level}" title="{$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)}">{$tag.name}</a></span> 27 {/foreach} 28 </div> 29 {/if} 30 31 {if $display_mode == 'letters' and isset($letters)} 32 <table> 33 <tr> 34 <td valign="top"> 35 {foreach from=$letters item=letter} 36 <fieldset class="tagLetter"> 37 <legend class="tagLetterLegend">{$letter.TITLE}</legend> 38 <table class="tagLetterContent"> 39 {foreach from=$letter.tags item=tag} 40 <tr class="tagLine"> 41 <td><a href="{$tag.URL}" title="{$tag.name}">{$tag.name}</a></td> 42 <td class="nbEntries">{$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)}</td> 43 </tr> 27 44 {/foreach} 28 </div> 29 {/if} 30 31 {if $display_mode == 'letters'} 32 <table> 33 <tr> 34 <td valign="top"> 35 {foreach from=$letters item=letter} 36 <fieldset class="tagLetter"> 37 <legend class="tagLetterLegend">{$letter.TITLE}</legend> 38 <table class="tagLetterContent"> 39 {foreach from=$letter.tags item=tag} 40 <tr class="tagLine"> 41 <td><a href="{$tag.URL}" title="{$tag.name}">{$tag.name}</a></td> 42 <td class="nbEntries">{$pwg->l10n_dec('%d photo', '%d photos', $tag.counter)}</td> 43 </tr> 44 {/foreach} 45 </table> 46 </fieldset> 47 {if isset($letter.CHANGE_COLUMN) } 48 </td> 49 <td valign="top"> 50 {/if} 51 {/foreach} 52 </td> 53 </tr> 54 </table> 55 {/if} 45 </table> 46 </fieldset> 47 {if isset($letter.CHANGE_COLUMN) } 48 </td> 49 <td valign="top"> 50 {/if} 51 {/foreach} 52 </td> 53 </tr> 54 </table> 56 55 {/if} 57 56
Note: See TracChangeset
for help on using the changeset viewer.