Changeset 2274 for trunk/include/category_default.inc.php
- Timestamp:
- Mar 11, 2008, 3:04:27 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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');
Note: See TracChangeset
for help on using the changeset viewer.