4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: mark1491 on August 18, 2006, 05:27:02 AM

Title: add paging to index
Post by: mark1491 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
Title: Re: add paging to index
Post by: V@no 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 :)
Title: Re: add paging to index
Post by: mark1491 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
Title: Re: add paging to index
Post by: V@no 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 :)
Title: Re: add paging to index
Post by: mark1491 on August 18, 2006, 07:03:34 AM
great! works perfect

Thanks,
Mark
Title: Re: add paging to index
Post by: Romson 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 ?
Title: Re: add paging to index
Post by: bergblume on February 20, 2009, 01:47:17 PM
brilliant and easy modification!
thanks a lot for sharing!  :thumbup:
Title: Re: add paging to index
Post by: __G__ on February 23, 2009, 02:36:52 AM
great mod successfully installed on 1.7.6 thanks
Title: paging mod w/ specified amount of new images on index.php
Post by: jacobmathias 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
Title: Re: add paging to index
Post by: jacobmathias 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!
Title: Re: paging mod w/ specified amount of new images on index.php
Post by: jacobmathias on March 24, 2011, 04:16:34 AM
anyone?
Title: Re: add paging to index
Post by: V@no on March 25, 2011, 03:05:01 AM
what error?
Title: Re: add paging to index
Post by: jacobmathias 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