Changeset 1130


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.

Location:
trunk
Files:
4 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?>
  • trunk/include/category_subcats.inc.php

    r1098 r1130  
    3333
    3434$query = '
    35 SELECT id, name, date_last, representative_picture_id
     35SELECT id, name, date_last, representative_picture_id, comment, nb_images
    3636  FROM '.CATEGORIES_TABLE.'
    3737  WHERE id_uppercat '.
     
    9999        'picture' => $image_id,
    100100        'name' => $row['name'],
    101         'date_last' => @$row['date_last']
     101        'date_last' => @$row['date_last'],
     102        'comment' => @$row['comment'],
     103        'nb_images' => $row['nb_images'],
    102104        )
    103105      );
     
    127129  }
    128130
    129   $template->assign_block_vars('thumbnails', array());
    130   // first line
    131   $template->assign_block_vars('thumbnails.line', array());
    132   // current row displayed
    133   $row_number = 0;
     131  $template->assign_block_vars('categories', array());
    134132 
    135133  foreach ($cat_thumbnails as $item)
    136134  {
    137135    $template->assign_block_vars(
    138       'thumbnails.line.thumbnail',
     136      'categories.category',
    139137      array(
    140         'IMAGE'       => $images[$item['picture']],
    141         'IMAGE_ALT'   => $item['name'],
    142         'IMAGE_TITLE' => $lang['hint_category'],
    143         'IMAGE_TS'    => get_icon(@$item['date_last']),
     138        'SRC'   => $images[$item['picture']],
     139        'ALT'   => $item['name'],
     140        'TITLE' => $lang['hint_category'],
     141        'ICON'  => get_icon(@$item['date_last']),
    144142       
    145         'U_IMG_LINK' => make_index_url(
     143        'URL' => make_index_url(
    146144          array(
    147145            'category' => $item['category'],
    148146            )
    149147          ),
    150         'CLASS'       => 'thumbCat',
     148        'NAME' => $item['name'],
     149        'NB_IMAGES' => $item['nb_images'],
     150        'DESCRIPTION' => @$item['comment'],
    151151        )
    152152      );
    153    
    154     $template->assign_block_vars(
    155       'thumbnails.line.thumbnail.category_name',
    156       array(
    157         'NAME' => $item['name']
    158         )
    159       );
    160    
    161     // create a new line ?
    162     if (++$row_number == $user['nb_image_line'])
    163     {
    164       $template->assign_block_vars('thumbnails.line', array());
    165       $row_number = 0;
    166     }
    167153  }
    168154}
  • trunk/template/yoga/content.css

    r1119 r1130  
    260260  vertical-align: top;
    261261}
     262
     263/* Category thumbnails on main page, CSS code inspired from MOD subcatify */
     264#content UL.thumbnailCategories {
     265  margin: 0;
     266  padding: 0;
     267  list-style: none;
     268  text-align: center;
     269}
     270
     271#content UL.thumbnailCategories LI {
     272  width: 49.9%; /* 49.9% for 2 per line, 33.3% for 3 per line*/
     273  margin:0;
     274  padding:0;
     275  float:left;
     276}
     277
     278#content DIV.thumbnailCategory {
     279  display:block;
     280  border: 1px solid #aaa;
     281  padding: 5px 0px 0px 4px;
     282  margin: 5px;
     283}
     284
     285#content DIV.thumbnailCategory DIV.description {
     286  font-size: 90%;
     287}
     288
     289#content DIV.thumbnailCategory DIV.description H3 {
     290  text-align: left;
     291  background: #eee;
     292  margin: 0;
     293  padding: 0.1em;
     294  font-size: 120%;
     295}
     296
     297#content DIV.thumbnailCategory DIV.description P {
     298  margin: 0;
     299}
     300
     301#content DIV.thumbnailCategory DIV.illustration {
     302  text-align: left;
     303  padding: 2px;
     304  float: left;
     305  width: 110px;   /* sorry, this is a very personal value :-( */
     306  height: 110px;
     307}
  • trunk/template/yoga/index.tpl

    r1119 r1130  
    177177  <!-- END calendar -->
    178178
    179   </div> <!-- content -->
     179  </div> <!-- titrePage -->
    180180
    181181<!-- BEGIN calendar -->
     
    232232<!-- END thumbnails -->
    233233
     234<!-- BEGIN categories -->
     235<ul class="thumbnailCategories">
     236  <!-- BEGIN category -->
     237  <li>
     238    <div class="thumbnailCategory">
     239      <div class="illustration">
     240        <a href="{categories.category.URL}">
     241          <img src="{categories.category.SRC}"
     242               alt="{categories.category.ALT}"
     243             title="{categories.category.TITLE}">
     244        </a>
     245      </div>
     246      <div class="description">
     247        <h3>
     248          {categories.category.ICON}
     249          <a href="{categories.category.URL}">{categories.category.NAME}</a>
     250        </h3>
     251        <p>{categories.category.NB_IMAGES} {lang:pictures}</p>
     252        <p>{categories.category.DESCRIPTION}</p>
     253      </div>
     254      <hr class="separation" />
     255    </div>
     256  </li>
     257  <!-- END category -->
     258</ul>
     259<hr class="separation" />
     260<!-- END categories -->
     261
    234262<!-- BEGIN cat_infos -->
    235263<!-- BEGIN navigation -->
Note: See TracChangeset for help on using the changeset viewer.