Page 1 of 1

upping the number of comments per page

Posted: Sat Mar 02, 2024 5:07 pm
by cassie75
Script URL: https://www.caroles-crafts.co.uk/feedback/gbook.php
Version of script: 1.9.0
Hosting company: SiteGround
URL of phpinfo.php: ??
URL of session_test.php: ??
What terms did you try when SEARCHING for a solution: version 1.9.0 extra entries per page

Write your message below:
couldn't find anything for version 1.9.0 on this forum using the search term above and quite a few variations. There is nothing in the readme file which came with the download.

I have 800+ entries which is 80+ pages, a bit much really and that is the small guestbook. I am transferring the entries from 2 old Lazarus Guestbooks which uses a too old php for my hoster - https://www.caroles-crafts.co.uk/gb/index.php - That only has 44 pages and even that is probably too many.

I have another guestbook i have yet to convert which currently has 106 pages and over 2000 entries - i did the smaller one first :-)

So if i could get this version to say 30 entries per page that would be excellent.

Re: upping the number of comments per page

Posted: Sat Mar 02, 2024 6:32 pm
by Klemen
Hmm, there is no built-in way to do that currently.

You could do it by modifying the gbook.php file a bit:

1. backup your existing gbook.php file
2. open the gbook.php in a powerful text editor, such as the free Notepad++ (do not use Microsoft Notepad)
3. find this line:

Code: Select all

$page = (isset($_REQUEST['page'])) ? intval($_REQUEST['page']) : 0;
Just BELOW that line, you will find this code:

Code: Select all

if ($page > 0)
{
    $start = ($page*10)-9;
    $end   = $start+9;
}
else
{
    $page  = 1;
    $start = 1;
    $end   = 10;
}
Change the 10 and 9 values to 30 and 29, like so:

Code: Select all

if ($page > 0)
{
    $start = ($page*30)-29;
    $end   = $start+29;
}
else
{
    $page  = 1;
    $start = 1;
    $end   = 30;
}
And, a few lines down, there is also:

Code: Select all

$pages = ceil($total/10);
Change 10 to 30:

Code: Select all

$pages = ceil($total/30);
4. save the modified gbook.php, upload to the server and test it.

If you would like 50 entries per page, you would change 10 and 9 to 50 and 49 in the original code following the above examples.

Re: upping the number of comments per page

Posted: Sun Mar 03, 2024 6:30 pm
by cassie75
That it brilliant - thank you so much - worked like a charm :lol: