Ignore:
Timestamp:
Apr 6, 2006, 1:08:37 AM (18 years ago)
Author:
plg
Message:

new: MOD subcatify integrated. On main page, thumbnails representing a
category are not displayed the same way as thumbnails representing a
picture. Feedback welcomed on this feature.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/category_recent_cats.inc.php

    r1092 r1130  
    3232 */
    3333
     34// FIXME: categories having no representant
     35// ($conf['allow_random_representative'] = true) are not displayed :-/
     36
    3437// retrieving categories recently update, ie containing pictures added
    3538// recently. The calculated table field categories.date_last will be
    3639// easier to use
    3740$query = '
    38 SELECT c.id AS category_id,uppercats,representative_picture_id,path,file,tn_ext
    39   FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGES_TABLE.' AS i
    40     ON i.id = c.representative_picture_id
    41   WHERE date_last > SUBDATE(CURRENT_DATE
    42                             ,INTERVAL '.$user['recent_period'].' DAY)';
     41SELECT c.id AS category_id
     42       , uppercats
     43       , representative_picture_id
     44       , path
     45       , file
     46       , c.comment
     47       , tn_ext
     48       , nb_images
     49  FROM '.CATEGORIES_TABLE.' AS c
     50    INNER JOIN '.IMAGES_TABLE.' AS i ON i.id = c.representative_picture_id
     51  WHERE date_last > SUBDATE(
     52    CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY
     53  )';
    4354if ( $user['forbidden_categories'] != '' )
    4455{
     
    5364if (mysql_num_rows($result) > 0)
    5465{
    55   $template->assign_block_vars('thumbnails', array());
    56   // first line
    57   $template->assign_block_vars('thumbnails.line', array());
    58   // current row displayed
    59   $row_number = 0;
     66  $template->assign_block_vars('categories', array());
    6067}
    6168
    62 $old_level_separator = $conf['level_separator'];
    63 $conf['level_separator'] = '<br />';
    6469// for each category, we have to search a recent picture to display and
    6570// the name to display
     
    6772{
    6873  $template->assign_block_vars(
    69     'thumbnails.line.thumbnail',
     74    'categories.category',
    7075    array(
    71       'IMAGE'       => get_thumbnail_src($row['path'], @$row['tn_ext']),
    72       'IMAGE_ALT'   => $row['file'],
    73       'IMAGE_TITLE' => $lang['hint_category'],
     76      'SRC'       => get_thumbnail_src($row['path'], @$row['tn_ext']),
     77      'ALT'   => $row['file'],
     78      'TITLE' => $lang['hint_category'],
    7479
    75       'U_IMG_LINK'  => make_index_url(
     80      'URL'  => make_index_url(
    7681        array(
    7782          'category' => $row['category_id'],
    7883          )
    7984        ),
     85      'NAME' => get_cat_display_name_cache($row['uppercats'], null, false),
     86      'NB_IMAGES' => $row['nb_images'],
     87      'DESCRIPTION' => @$row['comment'],
    8088      )
    8189    );
    82 
    83   $template->assign_block_vars(
    84     'thumbnails.line.thumbnail.category_name',
    85     array(
    86       'NAME' => get_cat_display_name_cache($row['uppercats'], null, false),
    87       )
    88     );
    89 
    90   // create a new line ?
    91   if (++$row_number == $user['nb_image_line'])
    92   {
    93     $template->assign_block_vars('thumbnails.line', array());
    94     $row_number = 0;
    95   }
    9690}
    97 $conf['level_separator'] = $old_level_separator;
    9891?>
Note: See TracChangeset for help on using the changeset viewer.