Page 1 of 1
Number of comments to show on a page in GBook version 1.7
Posted: Sat Aug 22, 2009 4:03 am
by uknowirock
Script URL:
Version of script: 1.7
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: limiting comments, comments on page
Write your message below:
While 10 is a good number of comments to show on a page, I have a project that requires me to lower that to 5
Is this done in gbook.php still? Anybody know the line number off hand?
If it's not done in gbook.php, I am way off, which file would it be in?
Thanks
Posted: Sat Aug 22, 2009 6:04 am
by Henrie
Hello uknowirock,
Not done in GBook version 1.7.
But easily done because the solution of the previous version works also here.
So here it goes.
Number of entries per page modification for GBook version 1.7
Open file
gbook.php
Find lines 147-167
Code: Select all
{
$start = ($page*10)-9;
$end = $start+9;
}
else
{
$page = 1;
$start = 1;
$end = 10;
}
$lines = file($settings['logfile']);
$total = count($lines);
if ($total > 0)
{
if ($end > $total)
{
$end = $total;
}
$pages = ceil($total/10);
and replace it with
Code: Select all
/* Number of entries per page modification by Henrie */
{
$start=($page*$settings['entries_page'])-($settings['entries_page']-1);
$end=$start+($settings['entries_page']-1);
}
else
{
$page = 1;
$start = 1;
$end=$settings['entries_page'];
}
$lines = file($settings['logfile']);
$total = count($lines);
if ($total > 0)
{
if ($end > $total)
{
$end = $total;
}
$pages = ceil($total/$settings['entries_page']);
/* End of number of entries per page modification by Henrie */
save and close the gbook.php file
Open the
settings.php file
Before the /* DO NOT EDIT BELOW */ part add
Code: Select all
/* Number of entries per page modification by Henrie */
/* Number of guestbook entries to be shown on each page */
$settings['entries_page']=5;
save and close the settings.php file.
Now you should be able to set the number of entries per page to whatever you like by changing the value in the settings.php file.
Greetings,
Henrie
PS. I changed the title of your post to a more meaningfull title. I hope this is okay with you.
Posted: Sat Aug 22, 2009 10:09 am
by Klemen
Thanks for sharing Henrie... something I forgot to add to 1.7, will be in 1.8.
Posted: Sat Aug 22, 2009 10:44 am
by Henrie
Okay Klemen, it is not so big a deal.
But a handy one if added.
Posted: Sat Aug 22, 2009 4:59 pm
by uknowirock
Thanks, I thought I had done it in previous versions. Thats not a tough fix.
No issues with the title either, it makes it so others can understand what I was trying to do
Posted: Sat Aug 22, 2009 5:06 pm
by Henrie
yes, so others can find it quicker if they want the same change.
And don't have to ask the question again.
Re: Number of comments to show on a page in GBook version 1.
Posted: Tue Mar 01, 2011 12:41 am
by Hawk
This is interesting. I did this and it seems to work fine.
Code: Select all
{
$start = ($page*5)-4;
$end = $start+4;
}
else
{
$page = 1;
$start = 1;
$end = 5;
}
$lines = file($settings['logfile']);
$total = count($lines);
Is this going to cause a problem?
You can see the Guestbook I did this with at this link:
http://artsbagelsandmore.com/gb/gbook.php
Re: Number of comments to show on a page in GBook version 1.
Posted: Tue Mar 01, 2011 12:49 am
by Henrie
If you have not changed this
to
a few lines further in the code, you will now be missing half the pages of entries.
And my code might be harder to do, but it is more flexible for all users and future changes.
Greetings,
Henrie
Re: Number of comments to show on a page in GBook version 1.
Posted: Tue Mar 01, 2011 12:55 am
by Hawk
Yes, I did also make that change.
It's not that your code is hard to do. I made my edits before I saw this thread.
If your changes would be better, it's not a problem for me to make those edits.
Looking at your edits, I see where it would be better. Thank you!
I'd buy you a bear but I can't even afford to buy myself one right now.

Re: Number of comments to show on a page in GBook version 1.
Posted: Tue Mar 01, 2011 6:20 am
by Henrie
Not a problem that you do not buy me a drink. That you are thinking about it is good enough for me
Greetings,
Henrie