Changeset 1132 for trunk/include
- Timestamp:
- Apr 6, 2006, 10:28:37 PM (19 years ago)
- Location:
- trunk/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/category_recent_cats.inc.php
r1130 r1132 61 61 $result = pwg_query( $query ); 62 62 63 // template thumbnail initialization 64 if (mysql_num_rows($result) > 0) 63 if ($conf['subcatify']) 65 64 { 66 $template->assign_block_vars('categories', array()); 67 } 68 69 // for each category, we have to search a recent picture to display and 70 // the name to display 71 while ( $row = mysql_fetch_array( $result ) ) 72 { 73 $template->assign_block_vars( 74 'categories.category', 65 $template->set_filenames( 75 66 array( 76 'SRC' => get_thumbnail_src($row['path'], @$row['tn_ext']), 77 'ALT' => $row['file'], 78 'TITLE' => $lang['hint_category'], 79 80 'URL' => make_index_url( 81 array( 82 'category' => $row['category_id'], 83 ) 84 ), 85 'NAME' => get_cat_display_name_cache($row['uppercats'], null, false), 86 'NB_IMAGES' => $row['nb_images'], 87 'DESCRIPTION' => @$row['comment'], 67 'mainpage_categories' => 'mainpage_categories.tpl', 88 68 ) 89 69 ); 70 71 // template thumbnail initialization 72 if (mysql_num_rows($result) > 0) 73 { 74 $template->assign_block_vars('categories', array()); 75 } 76 77 // for each category, we have to search a recent picture to display and 78 // the name to display 79 while ( $row = mysql_fetch_array( $result ) ) 80 { 81 $template->assign_block_vars( 82 'categories.category', 83 array( 84 'SRC' => get_thumbnail_src($row['path'], @$row['tn_ext']), 85 'ALT' => $row['file'], 86 'TITLE' => $lang['hint_category'], 87 88 'URL' => make_index_url( 89 array( 90 'category' => $row['category_id'], 91 ) 92 ), 93 'NAME' => get_cat_display_name_cache($row['uppercats'], null, false), 94 'NB_IMAGES' => $row['nb_images'], 95 'DESCRIPTION' => @$row['comment'], 96 ) 97 ); 98 } 99 100 $template->assign_var_from_handle('CATEGORIES', 'mainpage_categories'); 101 } 102 else 103 { 104 // template thumbnail initialization 105 if (mysql_num_rows($result) > 0) 106 { 107 $template->assign_block_vars('thumbnails', array()); 108 // first line 109 $template->assign_block_vars('thumbnails.line', array()); 110 // current row displayed 111 $row_number = 0; 112 } 113 114 $old_level_separator = $conf['level_separator']; 115 $conf['level_separator'] = '<br />'; 116 // for each category, we have to search a recent picture to display and 117 // the name to display 118 while ( $row = mysql_fetch_array( $result ) ) 119 { 120 $template->assign_block_vars( 121 'thumbnails.line.thumbnail', 122 array( 123 'IMAGE' => get_thumbnail_src($row['path'], @$row['tn_ext']), 124 'IMAGE_ALT' => $row['file'], 125 'IMAGE_TITLE' => $lang['hint_category'], 126 127 'U_IMG_LINK' => make_index_url( 128 array( 129 'category' => $row['category_id'], 130 ) 131 ), 132 ) 133 ); 134 135 $template->assign_block_vars( 136 'thumbnails.line.thumbnail.category_name', 137 array( 138 'NAME' => get_cat_display_name_cache($row['uppercats'], null, false), 139 ) 140 ); 141 142 // create a new line ? 143 if (++$row_number == $user['nb_image_line']) 144 { 145 $template->assign_block_vars('thumbnails.line', array()); 146 $row_number = 0; 147 } 148 } 149 $conf['level_separator'] = $old_level_separator; 90 150 } 91 151 ?> -
trunk/include/category_subcats.inc.php
r1131 r1132 44 44 // $conf['allow_random_representative'] 45 45 46 $cat_thumbnails = array(); 46 $categories = array(); 47 $image_ids = array(); 47 48 48 49 while ($row = mysql_fetch_array($result)) … … 92 93 93 94 $comment = null; 94 if ( isset($row['comment']))95 { 96 $comment = strip_tags( $row['comment']);95 if (isset($row['comment'])) 96 { 97 $comment = strip_tags($row['comment']); 97 98 } 98 99 … … 100 101 { 101 102 array_push( 102 $cat _thumbnails,103 $categories, 103 104 array( 104 'category' => $row['id'],105 'picture' => $image_id,106 'name' => $row['name'],107 'date_last' => @$row['date_last'],108 'comment' => $comment,109 'nb_images' => $row['nb_images'],105 'category' => $row['id'], 106 'picture' => $image_id, 107 'name' => $row['name'], 108 'date_last' => @$row['date_last'], 109 'comment' => $comment, 110 'nb_images' => $row['nb_images'], 110 111 ) 111 112 ); 113 114 array_push($image_ids, $image_id); 112 115 } 113 116 … … 115 118 } 116 119 117 if (count($ cat_thumbnails) > 0)120 if (count($image_ids) > 0) 118 121 { 119 $images = array(); 120 121 foreach ($cat_thumbnails as $item) 122 { 123 $images[$item['picture']] = ''; 124 } 122 $thumbnail_src_of = array(); 125 123 126 124 $query = ' 127 125 SELECT id, path, tn_ext 128 126 FROM '.IMAGES_TABLE.' 129 WHERE id IN ('.implode(',', array_keys($images)).')127 WHERE id IN ('.implode(',', $image_ids).') 130 128 ;'; 131 129 $result = pwg_query($query); 132 130 while ($row = mysql_fetch_array($result)) 133 131 { 134 $images[$row['id']] = get_thumbnail_src($row['path'], @$row['tn_ext']); 135 } 136 137 $template->assign_block_vars('categories', array()); 138 139 foreach ($cat_thumbnails as $item) 140 { 141 $template->assign_block_vars( 142 'categories.category', 132 $thumbnail_src_of[$row['id']] = 133 get_thumbnail_src($row['path'], @$row['tn_ext']); 134 } 135 136 if ($conf['subcatify']) 137 { 138 $template->set_filenames( 143 139 array( 144 'SRC' => $images[$item['picture']], 145 'ALT' => $item['name'], 146 'TITLE' => $lang['hint_category'], 147 'ICON' => get_icon(@$item['date_last']), 148 149 'URL' => make_index_url( 150 array( 151 'category' => $item['category'], 152 'cat_name' => $item['name'], 153 ) 154 ), 155 'NAME' => $item['name'], 156 'NB_IMAGES' => $item['nb_images'], 157 'DESCRIPTION' => @$item['comment'], 140 'mainpage_categories' => 'mainpage_categories.tpl', 158 141 ) 159 142 ); 143 144 $template->assign_block_vars('categories', array()); 145 146 foreach ($categories as $category) 147 { 148 $template->assign_block_vars( 149 'categories.category', 150 array( 151 'SRC' => $thumbnail_src_of[ $category['picture'] ], 152 'ALT' => $category['name'], 153 'TITLE' => $lang['hint_category'], 154 'ICON' => get_icon(@$category['date_last']), 155 156 'URL' => make_index_url( 157 array( 158 'category' => $category['category'], 159 'cat_name' => $category['name'], 160 ) 161 ), 162 'NAME' => $category['name'], 163 'NB_IMAGES' => $category['nb_images'], 164 'DESCRIPTION' => @$category['comment'], 165 ) 166 ); 167 } 168 169 $template->assign_var_from_handle('CATEGORIES', 'mainpage_categories'); 170 } 171 else 172 { 173 $template->assign_block_vars('thumbnails', array()); 174 // first line 175 $template->assign_block_vars('thumbnails.line', array()); 176 // current row displayed 177 $row_number = 0; 178 179 foreach ($categories as $category) 180 { 181 $template->assign_block_vars( 182 'thumbnails.line.thumbnail', 183 array( 184 'IMAGE' => $thumbnail_src_of[ $category['picture'] ], 185 'IMAGE_ALT' => $category['name'], 186 'IMAGE_TITLE' => $lang['hint_category'], 187 'IMAGE_TS' => get_icon(@$category['date_last']), 188 189 'U_IMG_LINK' => make_index_url( 190 array( 191 'category' => $category['category'], 192 ) 193 ), 194 'CLASS' => 'thumbCat', 195 ) 196 ); 197 198 $template->assign_block_vars( 199 'thumbnails.line.thumbnail.category_name', 200 array( 201 'NAME' => $category['name'] 202 ) 203 ); 204 205 // create a new line ? 206 if (++$row_number == $user['nb_image_line']) 207 { 208 $template->assign_block_vars('thumbnails.line', array()); 209 $row_number = 0; 210 } 211 } 160 212 } 161 213 } -
trunk/include/config_default.inc.php
r1131 r1132 169 169 $conf['show_picture_name_on_title'] = true; 170 170 171 // subcatify: display thumbnails representing a category a different way 172 // than thumbnails representing a picture. 173 $conf['subcatify'] = true; 174 171 175 // allow_random_representative : do you wish PhpWebGallery to search among 172 176 // categories elements a new representative at each reload ?
Note: See TracChangeset
for help on using the changeset viewer.