Changeset 2274
- Timestamp:
- Mar 11, 2008, 3:04:27 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_cats.inc.php
r2234 r2274 216 216 } 217 217 218 $template->set_filename('index_category_thumbnails', 'mainpage_categories.tpl'); 219 218 220 trigger_action('loc_begin_index_category_thumbnails', $categories); 219 if ($conf['subcatify']) 220 { 221 $template->set_filename('mainpage_categories', 'mainpage_categories.tpl'); 222 223 foreach ($categories as $category) 224 { 225 if ($page['section']=='recent_cats') 226 { 227 $name = get_cat_display_name_cache($category['uppercats'], null, false); 228 } 229 else 230 { 231 $name = $category['name']; 232 } 233 234 $icon_ts = get_icon($category['max_date_last'], $category['is_child_date_last']); 235 236 $tpl_var = 221 222 foreach ($categories as $category) 223 { 224 if ($page['section']=='recent_cats') 225 { 226 $name = get_cat_display_name_cache($category['uppercats'], null, false); 227 } 228 else 229 { 230 $name = $category['name']; 231 } 232 233 $icon_ts = get_icon($category['max_date_last'], $category['is_child_date_last']); 234 235 $tpl_var = 237 236 array( 238 237 'ID' => $category['id'], … … 260 259 'subcatify_category_description')), 261 260 'NAME' => $name, 262 ); 263 264 if ($conf['display_fromto']) 261 ); 262 263 if ($conf['display_fromto']) 264 { 265 if (isset($dates_of_category[ $category['id'] ])) 265 266 { 266 if (isset($dates_of_category[ $category['id'] ])) 267 $from = $dates_of_category[ $category['id'] ]['from']; 268 $to = $dates_of_category[ $category['id'] ]['to']; 269 270 if (!empty($from)) 267 271 { 268 $from = $dates_of_category[ $category['id'] ]['from']; 269 $to = $dates_of_category[ $category['id'] ]['to']; 270 271 if (!empty($from)) 272 $info = ''; 273 274 if ($from == $to) 272 275 { 273 $info = ''; 274 275 if ($from == $to) 276 { 277 $info = format_date($from); 278 } 279 else 280 { 281 $info = sprintf( 282 l10n('from %s to %s'), 283 format_date($from), 284 format_date($to) 285 ); 286 } 287 $tpl_var['INFO_DATES'] = $info; 276 $info = format_date($from); 288 277 } 278 else 279 { 280 $info = sprintf( 281 l10n('from %s to %s'), 282 format_date($from), 283 format_date($to) 284 ); 285 } 286 $tpl_var['INFO_DATES'] = $info; 289 287 } 290 }//fromto291 292 $template->append( 'category_thumbnails', $tpl_var);293 294 295 //plugins need to add/modify sth in this loop ?296 trigger_action('loc_index_category_thumbnail',297 $category, 'categories.category' );298 }299 300 $template->assign_var_from_handle('CATEGORIES', 'mainpage_categories');301 }302 else303 {304 $template->set_filename( 'thumbnails', 'thumbnails.tpl');305 306 if ($page['section']=='recent_cats')307 {308 $old_level_separator = $conf['level_separator'];309 $conf['level_separator'] = '<br />';310 }311 312 foreach ($categories as $category)313 {314 $tpl_var =315 array(316 'IMAGE' => $thumbnail_src_of[ $category['representative_picture_id'] ],317 'IMAGE_ALT' => $category['name'],318 'IMAGE_TITLE' => get_display_images_count319 (320 $category['nb_images'],321 $category['count_images'],322 $category['count_categories'],323 true,324 ' / '325 ),326 327 'U_IMG_LINK' => make_index_url(328 array(329 'category' => $category330 )331 ),332 'CLASS' => 'thumbCat',333 );334 if ($page['section']=='recent_cats')335 {336 $name = get_cat_display_name_cache($category['uppercats'], null, false);337 288 } 338 else 339 { 340 $name = $category['name']; 341 $tpl_var['IMAGE_TS'] = get_icon($category['max_date_last'], $category['is_child_date_last']); 342 } 343 $tpl_var['CATEGORY_NAME']=$name; 344 345 $template->append('thumbnails', $tpl_var); 346 347 //plugins need to add/modify sth in this loop ? 348 trigger_action('loc_index_category_thumbnail', 349 $category, 'thumbnails' ); 350 351 } 352 353 if ( isset($old_level_separator) ) 354 { 355 $conf['level_separator']=$old_level_separator; 356 } 357 358 $template->assign_var_from_handle('CATEGORIES', 'thumbnails'); 359 } 289 }//fromto 290 291 //plugins need to add/modify sth in this loop ? 292 $tpl_var = trigger_event('loc_index_category_thumbnail', 293 $tpl_var, $category ); 294 295 $template->append( 'category_thumbnails', $tpl_var); 296 } 297 360 298 trigger_action('loc_end_index_category_thumbnails', $categories); 299 $template->assign_var_from_handle('CATEGORIES', 'index_category_thumbnails'); 361 300 } 362 301 ?> -
trunk/include/category_default.inc.php
r2234 r2274 59 59 } 60 60 61 // template thumbnail initialization62 $template->set_filenames( array( 'thumbnails' => 'thumbnails.tpl',));63 61 if (count($pictures) > 0) 64 62 { … … 79 77 ); 80 78 81 $template->clear_assign('thumbnails'); // category_default reuse them 79 if ($user['show_nb_comments']) 80 { 81 $query = ' 82 SELECT image_id, COUNT(*) AS nb_comments 83 FROM '.COMMENTS_TABLE.' 84 WHERE validated = \'true\' 85 AND image_id IN ('.implode(',', $selection).') 86 GROUP BY image_id 87 ;'; 88 $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments'); 89 } 82 90 } 91 92 // template thumbnail initialization 93 $template->set_filenames( array( 'index_thumbnails' => 'thumbnails.tpl',)); 83 94 84 95 trigger_action('loc_begin_index_thumbnails', $pictures); … … 99 110 $tpl_var = 100 111 array( 101 'IMAGE' => $thumbnail_url, 102 'IMAGE_ALT' => $row['file'], 103 'IMAGE_TITLE' => get_thumbnail_title($row), 104 'IMAGE_TS' => get_icon($row['date_available']), 105 106 'U_IMG_LINK' => $url, 107 108 'CLASS' => 'thumbElmt', 112 'ID' => $row['id'], 113 'IMAGE' => $thumbnail_url, 114 'IMAGE_ALT' => $row['file'], 115 'IMAGE_TITLE' => get_thumbnail_title($row), 116 'IMAGE_TS' => get_icon($row['date_available']), 117 'U_IMG_LINK' => $url, 109 118 ); 110 119 111 120 if ($user['show_nb_hits']) 112 121 { 113 $tpl_var['nb_hits'] = 114 array( 115 'HITS'=> $row['hit'], 116 'CLASS'=> set_span_class($row['hit']), 117 ); 122 $tpl_var['NB_HITS'] = $row['hit']; 118 123 } 119 124 … … 149 154 } 150 155 151 if ( $user['show_nb_comments'])156 if ( isset($nb_comments_of) ) 152 157 { 153 $query = ' 154 SELECT COUNT(*) AS nb_comments 155 FROM '.COMMENTS_TABLE.' 156 WHERE image_id = '.$row['id'].' 157 AND validated = \'true\' 158 ;'; 159 list($row['nb_comments']) = mysql_fetch_array(pwg_query($query)); 160 $tpl_var['nb_comments'] = 161 array( 162 'NB_COMMENTS'=> $row['nb_comments'], 163 'CLASS'=> set_span_class($row['nb_comments']), 164 ); 158 $row['nb_comments'] = isset($nb_comments_of[$row['id']]) 159 ? (int)$nb_comments_of[$row['id']] : 0; 160 $tpl_var['NB_COMMENTS'] = $row['nb_comments']; 165 161 } 166 162 163 //plugins need to add/modify sth in this loop ? 164 $tpl_var = trigger_event('loc_index_thumbnail', $tpl_var, $row); 165 167 166 $template->append('thumbnails', $tpl_var); 168 169 //plugins need to add/modify sth in this loop ?170 trigger_action('loc_index_thumbnail', $row, 'thumbnails' );171 167 } 172 168 173 169 trigger_action('loc_end_index_thumbnails', $pictures); 174 $template->assign_var_from_handle('THUMBNAILS', ' thumbnails');170 $template->assign_var_from_handle('THUMBNAILS', 'index_thumbnails'); 175 171 176 172 pwg_debug('end include/category_default.inc.php'); -
trunk/include/config_default.inc.php
r2218 r2274 222 222 // name ? 223 223 $conf['show_picture_name_on_title'] = true; 224 225 // subcatify: display thumbnails representing a category a different way226 // than thumbnails representing a picture.227 $conf['subcatify'] = true;228 224 229 225 // display_fromto: in subcatify mode, display the date creation bounds of a -
trunk/template/yoga/thumbnails.tpl
r2234 r2274 4 4 <ul class="thumbnails"> 5 5 {foreach from=$thumbnails item=thumbnail} 6 <li class="{$thumbnail.CLASS}">6 <li> 7 7 <span class="wrap1"> 8 8 <span class="wrap2"> 9 9 <a href="{$thumbnail.U_IMG_LINK}"> 10 <img class="thumbnail" src="{$thumbnail.IMAGE}" 11 alt="{$thumbnail.IMAGE_ALT}" 12 title="{$thumbnail.IMAGE_TITLE}"> 10 <img class="thumbnail" src="{$thumbnail.IMAGE}" alt="{$thumbnail.IMAGE_ALT}" title="{$thumbnail.IMAGE_TITLE}" /> 13 11 </a> 14 12 </span> … … 16 14 17 15 {if !empty($thumbnail.ELEMENT_NAME)}{$thumbnail.ELEMENT_NAME}{/if} 18 {if !empty($thumbnail.CATEGORY_NAME)}{$thumbnail.CATEGORY_NAME}{/if}19 16 {if !empty($thumbnail.IMAGE_TS)}{$thumbnail.IMAGE_TS}{/if} 20 21 {if !empty($thumbnail.nb_comments)}22 <span class="{ $thumbnail.nb_comments.CLASS}nb-comments">17 18 {if isset($thumbnail.NB_COMMENTS)} 19 <span class="{if 0==$thumbnail.NB_COMMENTS}zero {/if}nb-comments"> 23 20 <br /> 24 {$pwg->l10n_dec('%d comment', '%d comments',$thumbnail. nb_comments.NB_COMMENTS)}21 {$pwg->l10n_dec('%d comment', '%d comments',$thumbnail.NB_COMMENTS)} 25 22 </span> 26 23 {/if} 27 28 {if !empty($thumbnail.nb_hits)}29 <span class="{ $thumbnail.nb_hits.CLASS}nb-hits">24 25 {if isset($thumbnail.NB_HITS)} 26 <span class="{if 0==$thumbnail.NB_HITS}zero {/if}nb-hits"> 30 27 <br /> 31 {$pwg->l10n_dec('%d hit', '%d hits',$thumbnail. nb_hits.HITS)}28 {$pwg->l10n_dec('%d hit', '%d hits',$thumbnail.NB_HITS)} 32 29 </span> 33 30 {/if}
Note: See TracChangeset
for help on using the changeset viewer.