Author Topic: Problem with Top of The Day MOD  (Read 5226 times)

0 Members and 1 Guest are viewing this topic.

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Problem with Top of The Day MOD
« on: March 28, 2010, 09:31:42 AM »
Hi, all

I`ve a little problem with my POTD MOD, look at this:

Code: [Select]
//-----------------------------------------------------
//--- Photo Of The Day --------------------------------
//-----------------------------------------------------

function get_potd_image() {
    global $site_db, $site_template, $select_mode;

$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");

switch (POTD_SELECT_MODE) {
case "rating" : $select_mode = "i.image_rating"; break;
case "votes" : $select_mode = "i.image_votes"; break;
case "comments" : $select_mode = "i.image_comments"; break;
case "downloads" : $select_mode = "i.image_downloads"; break;
case "hits" : $select_mode = "i.image_hits"; break;
case "by_hits" : $select_mode = "i.image_hits"; $select_mode2 = ", i.image_name ASC"; break;
case "random" : $selection = array('rating', 'votes', 'hits', 'comments', 'downloads');
mt_srand((double) microtime() * 1000000);
$select_mode = 'i.image_'.$selection[mt_rand(0, (count($selection)-1))];
break;
}

$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, 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 i.cat_id NOT IN ($cat_id_sql) AND c.cat_id = i.cat_id AND i.image_date >= ".(mktime(0, 0, 0, date("m")  , 1, date("Y")))."
            ORDER BY $select_mode DESC LIMIT 3";

  $potd_image = $site_db->query_firstrow($sql);
$site_db->free_result();
$template = 'potd_image';
show_image($potd_image, "", 1);
$potd_image = $site_template->parse_template($template);
return $potd_image;
}

I set limit on 3, but it show me only 1 image... How to do 3???

Thanks!