Author Topic: Show photos by 3 days, week, month and year  (Read 3736 times)

0 Members and 1 Guest are viewing this topic.

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Show photos by 3 days, week, month and year
« on: April 30, 2010, 11:38:39 AM »
Good day to all.

If respected Admins will decide that this is the MOD. Replace this to Mods & Plugins (Releases & Support) topic.

Description:

This mod will show you photos by three days, last week, last 30 days and last year since current date.

Installation:


1. In search.php
find:
Code: [Select]
if ($search_new_images && $show_result == 1) {
  $search_id['search_new_images'] = 1;
}

add after:
Code: [Select]
if ($search_new_images == 3) {
  $search_id['search_new_images'] = 3;
}
if ($search_new_images == 7) {
  $search_id['search_new_images'] = 7;
}
if ($search_new_images == 30) {
  $search_id['search_new_images'] = 30;
}
if ($search_new_images == 365) {
  $search_id['search_new_images'] = 365;
}

1.2 find:
Code: [Select]
if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }

add after:
Code: [Select]
  if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 3) {
    $new_cutoff = time() - 60 * 60 * 24 * 3;
    $sql_where_query .= "AND i.image_date >= $new_cutoff";
  }
 
    if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 7) {
    $new_cutoff = time() - 60 * 60 * 24 * 7;
    $sql_where_query .= "AND i.image_date >= $new_cutoff";
  }
 
    if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 30) {
    $new_cutoff = time() - 60 * 60 * 24 * 30;
    $sql_where_query .= "AND i.image_date >= $new_cutoff";
  }
 
    if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 365) {
    $new_cutoff = time() - 60 * 60 * 24 * 365;
    $sql_where_query .= "AND i.image_date >= $new_cutoff";
  }

2. In includes/page_header:
find:
Code: [Select]
"url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),
add after:
Code: [Select]
"url_new_images_tree" => $site_sess->url(ROOT_PATH."search.php?search_new_images=3"),
    "url_new_images_week" => $site_sess->url(ROOT_PATH."search.php?search_new_images=7"),
      "url_new_images_month" => $site_sess->url(ROOT_PATH."search.php?search_new_images=30"),
        "url_new_images_year" => $site_sess->url(ROOT_PATH."search.php?search_new_images=365"),

3. In home.html:
insert when you need:
Code: [Select]
<a href="<?=$site_sess->url(ROOT_PATH."search.php?search_new_images=3")?>"><b>Last 3 Days Photos</b></a>&nbsp;
<a href="<?=$site_sess->url(ROOT_PATH."search.php?search_new_images=7")?>"><b>Last 7 Days Photos</b></a>&nbsp;
<a href="<?=$site_sess->url(ROOT_PATH."search.php?search_new_images=30")?>"><b>Last 30 Days Photos</b></a>&nbsp;
<a href="<?=$site_sess->url(ROOT_PATH."search.php?search_new_images=365")?>"><b>Last 365 Days Photos</b></a>&nbsp;


This is all..

ONE QUESTION. Anyone have idea how it realize to sort by image hits????

Offline dsc_phi

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • MonSitePhotos
Re: Show photos by 3 days, week, month and year
« Reply #1 on: July 22, 2011, 01:23:06 PM »
Not working, ça ne marche pas ...