Changeset 134


Ignore:
Timestamp:
Sep 19, 2003, 11:41:42 PM (21 years ago)
Author:
z0rglub
Message:
  • 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/category.php

    r128 r134  
    348348  $i = 0;
    349349  foreach ( $subcats as $subcat_id => $non_empty_id ) {
    350     $subcat_infos  = get_cat_info( $subcat_id );
    351 
    352     $name ='[ <span style="font-weight:bold;">';
    353     $name.= $subcat_infos['name'][0];
     350    $name = '<img src="'.$user['lien_collapsed'].'" style="border:none;"';
     351    $name.= ' alt="&gt;"/> ';
     352    $name.= '[ <span style="font-weight:bold;">';
     353    $name.= $page['plain_structure'][$subcat_id]['name'];
    354354    $name.= '</span> ]';
    355355
     356    // searching the representative picture of the category
     357    $query = 'SELECT representative_picture_id';
     358    $query.= ' FROM '.PREFIX_TABLE.'categories';
     359    $query.= ' WHERE id = '.$non_empty_id;
     360    $row = mysql_fetch_array( mysql_query( $query ) );
     361   
    356362    $query = 'SELECT file,tn_ext,storage_category_id';
    357363    $query.= ' FROM '.PREFIX_TABLE.'images';
    358364    $query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category ON id = image_id';
    359365    $query.= ' WHERE category_id = '.$non_empty_id;
    360     $query.= ' ORDER BY RAND()';
     366    // if the category has a representative picture, this is its thumbnail
     367    // tha will be displayed !
     368    if ( $row['representative_picture_id'] != '' )
     369      $query.= ' AND id = '.$row['representative_picture_id'];
     370    else
     371      $query.= ' ORDER BY RAND()';
    361372    $query.= ' LIMIT 0,1';
    362373    $query.= ';';
     
    384395    $url_link.= $subcat_id;
    385396
    386     list( $year,$month,$day ) = explode( '-', $subcat_infos['date_last'] );
    387     $date = mktime( 0, 0, 0, $month, $day, $year );
     397    $date = $page['plain_structure'][$subcat_id]['date_last'];
    388398
    389399    // sending vars to display
Note: See TracChangeset for help on using the changeset viewer.