diff options
author | plegall <plg@piwigo.org> | 2006-04-06 20:28:37 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2006-04-06 20:28:37 +0000 |
commit | a892e6abf95a23219d76971890011646f7efeef4 (patch) | |
tree | edb73db7a0655fad888ae8464de5525c1c4c91ef /include/category_recent_cats.inc.php | |
parent | d700a5917233fb8049589a9e0aef3d94e87fb320 (diff) |
modification: "subcatify" becomes optionnal. Enabled by default, easy to
revert to previous display.
git-svn-id: http://piwigo.org/svn/trunk@1132 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/category_recent_cats.inc.php')
-rw-r--r-- | include/category_recent_cats.inc.php | 106 |
1 files changed, 83 insertions, 23 deletions
diff --git a/include/category_recent_cats.inc.php b/include/category_recent_cats.inc.php index b3d86ed91..44494c9df 100644 --- a/include/category_recent_cats.inc.php +++ b/include/category_recent_cats.inc.php @@ -60,32 +60,92 @@ $query.= ' ;'; $result = pwg_query( $query ); -// template thumbnail initialization -if (mysql_num_rows($result) > 0) +if ($conf['subcatify']) { - $template->assign_block_vars('categories', array()); -} - -// for each category, we have to search a recent picture to display and -// the name to display -while ( $row = mysql_fetch_array( $result ) ) -{ - $template->assign_block_vars( - 'categories.category', + $template->set_filenames( array( - 'SRC' => get_thumbnail_src($row['path'], @$row['tn_ext']), - 'ALT' => $row['file'], - 'TITLE' => $lang['hint_category'], - - 'URL' => make_index_url( - array( - 'category' => $row['category_id'], - ) - ), - 'NAME' => get_cat_display_name_cache($row['uppercats'], null, false), - 'NB_IMAGES' => $row['nb_images'], - 'DESCRIPTION' => @$row['comment'], + 'mainpage_categories' => 'mainpage_categories.tpl', ) ); + + // template thumbnail initialization + if (mysql_num_rows($result) > 0) + { + $template->assign_block_vars('categories', array()); + } + + // for each category, we have to search a recent picture to display and + // the name to display + while ( $row = mysql_fetch_array( $result ) ) + { + $template->assign_block_vars( + 'categories.category', + array( + 'SRC' => get_thumbnail_src($row['path'], @$row['tn_ext']), + 'ALT' => $row['file'], + 'TITLE' => $lang['hint_category'], + + 'URL' => make_index_url( + array( + 'category' => $row['category_id'], + ) + ), + 'NAME' => get_cat_display_name_cache($row['uppercats'], null, false), + 'NB_IMAGES' => $row['nb_images'], + 'DESCRIPTION' => @$row['comment'], + ) + ); + } + + $template->assign_var_from_handle('CATEGORIES', 'mainpage_categories'); +} +else +{ + // template thumbnail initialization + if (mysql_num_rows($result) > 0) + { + $template->assign_block_vars('thumbnails', array()); + // first line + $template->assign_block_vars('thumbnails.line', array()); + // current row displayed + $row_number = 0; + } + + $old_level_separator = $conf['level_separator']; + $conf['level_separator'] = '<br />'; + // for each category, we have to search a recent picture to display and + // the name to display + while ( $row = mysql_fetch_array( $result ) ) + { + $template->assign_block_vars( + 'thumbnails.line.thumbnail', + array( + 'IMAGE' => get_thumbnail_src($row['path'], @$row['tn_ext']), + 'IMAGE_ALT' => $row['file'], + 'IMAGE_TITLE' => $lang['hint_category'], + + 'U_IMG_LINK' => make_index_url( + array( + 'category' => $row['category_id'], + ) + ), + ) + ); + + $template->assign_block_vars( + 'thumbnails.line.thumbnail.category_name', + array( + 'NAME' => get_cat_display_name_cache($row['uppercats'], null, false), + ) + ); + + // create a new line ? + if (++$row_number == $user['nb_image_line']) + { + $template->assign_block_vars('thumbnails.line', array()); + $row_number = 0; + } + } + $conf['level_separator'] = $old_level_separator; } ?>
\ No newline at end of file |