Adding Number of Comments field

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
koxley
Posts: 3
Joined: Tue Jan 10, 2006 2:02 am

Adding Number of Comments field

Post by koxley »

Script URL:
Version of script:
Version of PHP:
Hosting company:
Have you searched THIS FORUM for your problem:
(if not please do before posting)
If so, what terms did you try:

Write your message below:
Love this guestbook. Its been very easy to work with and modify.

I have a request from a client that wants to add a field that each time someone signs his guestbook he wants a number assigned to it to show how many comments has been made.

Can anyone help?
koxley
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

Hello Koxley,

To display the total number of entries you can change this code (starting at line 123 in GBook version 1.34):

Code: Select all

else {
$total = count($lines);
	if ($end > $total) {$end=$total;}
$pages = ceil($total/10);
echo '<p>Displaying page '.$page.' of '.$pages.'. Pages: ';
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<b>$i</b>\n";}
        else {echo '<a href="gbook.php?page='.$i.'">'.$i.'</a> ';}
	}
}
To this code:

Code: Select all

else {
$total = count($lines);
	if ($end > $total) {$end=$total;}
$pages = ceil($total/10);
echo '<p>Displaying page '.$page.' of '.$pages.'. Pages: ';
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<b>$i</b>\n";}
        else {echo '<a href="gbook.php?page='.$i.'">'.$i.'</a> ';}
	}
echo '<br>Total number of entries is '.$total.'.';
}
I added this line
echo '<br>Total number of entries is '.$total.'.';
which shows the number of entries just below the line in which the numbers of pages is displayed.

The variable $total shows the number of entries in the entries.txt file.

Greetings,
Henrie
koxley
Posts: 3
Joined: Tue Jan 10, 2006 2:02 am

Post by koxley »

Thank you for doing this. I upgraded to 1.41 and it still worked.
Thanks!
koxley
Post Reply