Passt hervorragend.
Hier der Code dazu....
//################################# Start New Cat #####################################
$num_new_cat = 4; //$config['image_cells'];
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
GROUP BY i.cat_id DESC
ORDER BY i.cat_id DESC
LIMIT $num_new_cat";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$new_cat = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$new_cat .= $lang['no_new_images'];
$new_cat .= "</td></tr></table>";
}
else {
$new_cat = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$new_cat .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$new_cat .= "<td valign=\"top\">\n";
$new_cat_img = get_thumbnail_code($image_row['image_media_file'],$image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'],$mode, 0);
$cat_img = "<a href=\"".$site_sess->url(ROOT_PATH)."categories.php?cat_id=".$image_row['cat_id']."\">".$new_cat_img."</a>";
$site_template->register_vars(array(
"cat_img" => $cat_img,
"image_name" => format_text($image_row['image_name'], 2),
"lang_new" => $lang['new'],
"cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$image_row['cat_id']),
"cat_id" => $image_row['cat_id'],
"cat_name" => format_text($image_row['cat_name'], 2)
));
$new_cat .= $site_template->parse_template("thumbnail_cat_bit");
$new_cat .= "\n</td>\n";
$count++;
if ($count == $num_new_cat) {
$new_cat .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($num_new_cat - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$new_cat .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$new_cat .= "</tr>\n";
}
}
$new_cat .= "</table>\n";
} // end else
$site_template->register_vars("new_cat", $new_cat);
unset($new_cat);
//#################################### End New Cat ###########################################