Author Topic: [Mod] Paging for new Images  (Read 11256 times)

0 Members and 1 Guest are viewing this topic.

Rembrandt

  • Guest
[Mod] Paging for new Images
« on: May 09, 2013, 06:49:27 PM »
Hi!

1.) search in index.php:

$imgtable_width 
ceil(intval($config['image_table_width']) / $config['image_cells']);

insert above:

// ############# Start Paging new images #######################
  
$sql "SELECT COUNT(image_id) AS new_images
          FROM "
.IMAGES_TABLE."
          WHERE image_active = 1 AND cat_id not in ("
.get_auth_cat_sql("auth_viewcat""NOTIN").") AND image_date >= $new_cutoff
          "
;
$result $site_db->query_firstrow($sql);

$num_rows_all = (isset($result['new_images'])) ? $result['new_images'] : 0;
$link_arg $site_sess->url(ROOT_PATH."index.php");

include(
ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page$perpage$num_rows_all$link_arg);
$offset $getpaging->get_offset();

$site_template->register_vars(array(
  
"page" => $page,
  
"paging" => $getpaging->get_paging(),
  
"paging_stats" => $getpaging->get_paging_stats()
));
// ############# End Paging new images #######################

1.1) search:

        WHERE i
.image_active AND c.cat_id i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        
ORDER BY i.image_date DESC
        LIMIT $num_new_images
";

and replace:

        WHERE i
.image_active AND c.cat_id i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND image_date >= $new_cutoff
        ORDER BY i
.image_date DESC
        LIMIT $offset
$perpage";


2.) search in your template/home.html:
Code: [Select]
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head1">
                        <table width="100%" border="0" cellspacing="0" cellpadding="4">
                          <tr>
                            <td class="head1" valign="top">{lang_new_images}</td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                    <tr>
                      <td class="head1">{new_images}</td>
                    </tr>
                  </table>
insert above:
Code: [Select]
{paging_stats}
insert below:
Code: [Select]
<br>
{paging}
<br>

mfg Andi

Offline Szooguun

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: [Mod] Paging for new Images
« Reply #1 on: May 10, 2013, 05:37:21 PM »
Great job. What can I do to have three rows of new pictures on the home page?

Rembrandt

  • Guest
Re: [Mod] Paging for new Images
« Reply #2 on: May 10, 2013, 05:58:19 PM »
ACP /General / Settings / Image settings / Image table rows

or search in the code above:

include(ROOT_PATH.'includes/paging.php');

insert above:

$perpage 
ceil($config['image_cells']);


mfg Andi
« Last Edit: May 10, 2013, 06:12:23 PM by Rembrandt »

Offline Szooguun

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: [Mod] Paging for new Images
« Reply #3 on: May 10, 2013, 06:30:38 PM »
or search in the code above:

include(ROOT_PATH.'includes/paging.php');

insert above:

$perpage 
ceil($config['image_cells']);


mfg Andi

works great, thanks

Rembrandt

  • Guest