last Month
1.) search in the HTML code {last_week} and replace with {last_month}
2.) replace the PHP code with this one:
$startTime = mktime(0, 0, 0, date("m")-1, 1, date("Y"));
$endTime = mktime(0, 0, 0, date("m"), 0, date("Y"));
$num_new_images = $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").") AND i.image_date BETWEEN ".$startTime." AND ".$endTime."
ORDER BY i.image_rating DESC
LIMIT $num_new_images
";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$last_month = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$last_month .= "No Images last week !";
$last_month .= "</td></tr></table>";
}
else {
$last_month = "<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;
$last_month .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$last_month .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row);
$last_month .= $site_template->parse_template("thumbnail_bit");
$last_month .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$last_month .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$last_month .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$last_month .= "</tr>\n";
}
}
$last_month .= "</table>\n";
} // end else
$site_template->register_vars("last_month", $last_month);
unset($last_month);
mfg Andi