Number of comments to show on a page in GBook version 1.7
-
- Posts: 3
- Joined: Sat Aug 22, 2009 3:57 am
Number of comments to show on a page in GBook version 1.7
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
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
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-167and replace it withsave and close the gbook.php file
Open the settings.php file
Before the /* DO NOT EDIT BELOW */ part addsave 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.
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);
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 */
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;
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.
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Thanks for sharing Henrie... something I forgot to add to 1.7, will be in 1.8.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here 
You should follow me on Twitter here
Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools


Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...
Also browse for php hosting companies, read php books, find php resources and use webmaster tools
-
- Posts: 3
- Joined: Sat Aug 22, 2009 3:57 am
Re: Number of comments to show on a page in GBook version 1.
This is interesting. I did this and it seems to work fine.
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
Code: Select all
{
$start = ($page*5)-4;
$end = $start+4;
}
else
{
$page = 1;
$start = 1;
$end = 5;
}
$lines = file($settings['logfile']);
$total = count($lines);
You can see the Guestbook I did this with at this link: http://artsbagelsandmore.com/gb/gbook.php
[size=100][i]Hawk[/i][/size]
Re: Number of comments to show on a page in GBook version 1.
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
Code: Select all
$pages = ceil($total/10);
Code: Select all
$pages = ceil($total/5);
And my code might be harder to do, but it is more flexible for all users and future changes.
Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
Re: Number of comments to show on a page in GBook version 1.
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.
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.

[size=100][i]Hawk[/i][/size]
Re: Number of comments to show on a page in GBook version 1.
Not a problem that you do not buy me a drink. That you are thinking about it is good enough for me 
Greetings,
Henrie

Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.