Author Topic: add paging to index  (Read 29510 times)

0 Members and 1 Guest are viewing this topic.

Offline mark1491

  • Newbie
  • *
  • Posts: 25
    • View Profile
add paging to index
« on: August 18, 2006, 05:27:02 AM »
I there any way to add paging to my home.html template.  Right now I have it manually set to show the lastest 8 images in index.php and that is it.

But I would like it to show the 8 images, plus have paging at the bottom so that the rest of my pictures in all categories can be shown if the users want to see them all together according to the date.

Thanks
Mark

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: add paging to index
« Reply #1 on: August 18, 2006, 05:49:36 AM »
hmmm...how come this wasnt ever requested before?...its quet good idea ;)

In index.php find:
Code: [Select]
$num_new_images = $config['image_cells'];Insert below:
Code: [Select]
$sql = "SELECT COUNT(image_id) as num
        FROM ".IMAGES_TABLE."
        WHERE image_active = 1 AND cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";
if (!$result = $site_db->query_firstrow($sql))
{
  $result['num'] = 0;
}
$link_arg = $site_sess->url(ROOT_PATH."index.php");

include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $num_new_images, $result['num'], $link_arg);
$offset = $getpaging->get_offset();

$site_template->register_vars(array(
  "paging" => $getpaging->get_paging(),
  "paging_stats" => $getpaging->get_paging_stats()
));

Then find:
Code: [Select]
        LIMIT $num_new_images";
Replace with:
Code: [Select]
        LIMIT $offset, $num_new_images";

And finaly add {paging} and {paging_stats} tags in home.html template :)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline mark1491

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: add paging to index
« Reply #2 on: August 18, 2006, 06:25:26 AM »
V@no:

When cache is enabled the pages to do not change, but when I disable it, it works right,

Is there any way I can enable caching for the index still?

Thanks,
Mark

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: add paging to index
« Reply #3 on: August 18, 2006, 06:57:18 AM »
In index.php find:
Code: [Select]
    isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
Insert above:
Code: [Select]
    $page,
    $config['image_cells'],

Should work now :)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline mark1491

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: add paging to index
« Reply #4 on: August 18, 2006, 07:03:34 AM »
great! works perfect

Thanks,
Mark

Offline Romson

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: add paging to index
« Reply #5 on: December 04, 2006, 05:56:20 PM »
Hi,

if a user click on a image, the next/previous links in the details page show the next/previous image by date from the category of this image

waht i need:

when a user click on a image FROM THE INDEX PAGE, the next/previous links on the details page should link to the next/previous images ( by date) from all images , not only from the image category

any idea how it could work ?
« Last Edit: December 07, 2006, 04:18:40 PM by Romson »

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: add paging to index
« Reply #6 on: February 20, 2009, 01:47:17 PM »
brilliant and easy modification!
thanks a lot for sharing!  :thumbup:

Offline __G__

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: add paging to index
« Reply #7 on: February 23, 2009, 02:36:52 AM »
great mod successfully installed on 1.7.6 thanks

Offline jacobmathias

  • Pre-Newbie
  • Posts: 7
    • View Profile
paging mod w/ specified amount of new images on index.php
« Reply #8 on: March 10, 2011, 07:20:32 PM »
I love the paging mod on index.php and implemented it successfully within 4images, but now I want to have 12 "new" images show on index.php, not the default 4 images.

I used a code I found in another topic,

Multiple New Images on Index.php code
$num_new_images 12; (This works with 4images naturally, but with the paging mod, it causes an error)

Paging mod code
 $num_new_images $config['image_cells']; 

How do I integrate both mods together? Which results in index.php paging &&& Specified amount of new images shown on index.php?

The link to the index.php paging mod is: http://www.4homepages.de/forum/index.php?topic=14195.msg156293#msg156293



Thanks
« Last Edit: March 10, 2011, 08:46:16 PM by jacobmathias »

Offline jacobmathias

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: add paging to index
« Reply #9 on: March 10, 2011, 08:37:53 PM »
How can I add more than (4) new images on index.html with this mod. I've tried the code

$num_new_images 36


but it causes an error, I'd appreciate a way to implement this within this paging mod. Thanks!

Offline jacobmathias

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: paging mod w/ specified amount of new images on index.php
« Reply #10 on: March 24, 2011, 04:16:34 AM »
anyone?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: add paging to index
« Reply #11 on: March 25, 2011, 03:05:01 AM »
what error?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline jacobmathias

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: add paging to index
« Reply #12 on: May 26, 2011, 08:39:14 PM »
Well I tried to recreate the error and now it works, i'll be damned. lol  :P