Page 1 of 1

How to number the entries in the guestbook.

Posted: Fri Jun 23, 2006 11:13 pm
by schimata
Script URL:
Version of script: 1.34
Version of PHP:
Hosting company: powweb.com
Have you searched THIS FORUM for your problem: yes
(if not please do before posting)
If so, what terms did you try: number

Write your message below:

Hi,

First of all let me congratulate you for such a fabulous tool. I am wondering if I can see the total number of posts (apart from the total number of pages) on the Guestbook main page.

I currently have 1.34 version. How can I have the nubmer of entries feature on the guestbool (even better if we can just number the entries).

Thanks in advance,
Srini

Posted: Tue Jun 27, 2006 5:40 am
by schimata
Hey guys...

Why is noone answering my questions.

Can we have the total number of posts in gbook or not?

Thanks,
Srini

Posted: Tue Jul 04, 2006 4:12 am
by schimata
Can any one answer the question pl?

Thanks in advance,
Srini

Posted: Tue Jul 04, 2006 8:07 am
by Klemen
Hi,

First of all you should upgrade to the latest version, I don't think a lot of people here have v1.34 and can't really help.

In gbook.php version 1.34 on line 124 (an in 1.41 on line 170) you have a variable called

Code: Select all

$total
. This variable contains the total number of posts, print it out to HTML wherever you want the total number of posts displayed.

Posted: Mon Jul 10, 2006 3:48 am
by schimata
Thanks man!

That worked ($total variable)..

Your guestbook rocks!!!!!! 8) 8)

Thanks,
Srini

Posted: Mon Jul 10, 2006 8:56 am
by Klemen
Hi,

You're welcome. You are invited (but in no way required) to rate GBook or even post a review at
http://php.resourceindex.com/rate?05414
and/or
http://www.hotscripts.com/Detailed/37192.html

Regards,

Posted: Sun Jul 16, 2006 6:56 pm
by zoli400
So open the gbook.php in an editor. Find

Code: Select all

function printEntries($lines,$start,$end)
It's about line 745. In this function after the line:

Code: Select all

$delimiter="\t";
copy this:

Code: Select all

$file = "entries.txt";
$all = count(file($file));
$all will show the number of entries ;)
After the line

Code: Select all

list($name,$from,$email,$url,$comment,$added,$isprivate,$reply)=explode($delimiter,$lines[$i]);
insert:

Code: Select all

$num = $all -  $i;
So $num is the number of the entry. Let's write it out. You can use it ex. in line

Code: Select all

<td class="upper" width="65%"><b>'.$num.'. Comments:</b></td>
And the comments will be numbered :wink: