aboutsummaryrefslogtreecommitdiffstats
path: root/category.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2003-09-19 21:41:42 +0000
committerz0rglub <z0rglub@piwigo.org>2003-09-19 21:41:42 +0000
commit8eb18bb8899e7586e79365737967e43c75b2cb78 (patch)
tree52d05d04be4aa02379990c455f69f996e860a581 /category.php
parent26452aed650f879803d9211968457696970d44d0 (diff)
- A category can have its representative picture
- Use the plain structure instead of the get_cat_info for retrieving the last date of a category git-svn-id: http://piwigo.org/svn/trunk@134 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--category.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/category.php b/category.php
index 285c69d68..32f4dff0d 100644
--- a/category.php
+++ b/category.php
@@ -347,17 +347,28 @@ elseif ( ( isset( $page['cat'] )
$cell_number = 1;
$i = 0;
foreach ( $subcats as $subcat_id => $non_empty_id ) {
- $subcat_infos = get_cat_info( $subcat_id );
-
- $name ='[ <span style="font-weight:bold;">';
- $name.= $subcat_infos['name'][0];
+ $name = '<img src="'.$user['lien_collapsed'].'" style="border:none;"';
+ $name.= ' alt="&gt;"/> ';
+ $name.= '[ <span style="font-weight:bold;">';
+ $name.= $page['plain_structure'][$subcat_id]['name'];
$name.= '</span> ]';
+ // searching the representative picture of the category
+ $query = 'SELECT representative_picture_id';
+ $query.= ' FROM '.PREFIX_TABLE.'categories';
+ $query.= ' WHERE id = '.$non_empty_id;
+ $row = mysql_fetch_array( mysql_query( $query ) );
+
$query = 'SELECT file,tn_ext,storage_category_id';
$query.= ' FROM '.PREFIX_TABLE.'images';
$query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id';
$query.= ' WHERE category_id = '.$non_empty_id;
- $query.= ' ORDER BY RAND()';
+ // if the category has a representative picture, this is its thumbnail
+ // tha will be displayed !
+ if ( $row['representative_picture_id'] != '' )
+ $query.= ' AND id = '.$row['representative_picture_id'];
+ else
+ $query.= ' ORDER BY RAND()';
$query.= ' LIMIT 0,1';
$query.= ';';
$image_result = mysql_query( $query );
@@ -383,8 +394,7 @@ elseif ( ( isset( $page['cat'] )
if ( $page['expand'] != '' ) $url_link.= ',';
$url_link.= $subcat_id;
- list( $year,$month,$day ) = explode( '-', $subcat_infos['date_last'] );
- $date = mktime( 0, 0, 0, $month, $day, $year );
+ $date = $page['plain_structure'][$subcat_id]['date_last'];
// sending vars to display
$vtp->addSession( $handle, 'thumbnail' );