Adding spacing between entries in v1.5

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
jayceegee
Posts: 33
Joined: Sun May 21, 2006 6:33 pm

Adding spacing between entries in v1.5

Post by jayceegee »

Script URL: www.jimgratton.co.uk/gen_gb/gbook.php
Version of script: 1.5
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: N/A

Write your message below:

Hello Henrie

In viewtopic.php?t=1019 you gave mirnot some great information on how to show spaces between each entry. I used this successfully in v1.43 and have tried to reproduce this in v1.5, but cannot get it to work with the last line </tr> changed to </tr></table> (line 830 in 1.43 – line 930 in 1.5) even though I have found (?) the exact same positions (not lines). It will work if the <br> is added after the table but is fixed, whereas the style.css (with margin-bottom) gives a nice variable spacing.

Could you when time permits, have a look at it for v1.5 as it helps to give a much better look to the guestbook.

Thank you in anticipation. Jim
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

Hello jayceegee,

Because Klemen has introduced some new styles in the style.css file my previous solution did not work.

To create spacing between the entries with use of the stylesheet do the following.

Mentioned line numbers are for Gbook version 1.5

Change file style.css

Find:

Code: Select all

div.centered table {
	margin: 0 auto; 
	text-align: left;
}
and change it to

Code: Select all

div.centered table.entries {
	margin: 0 auto; 
	text-align: left;
	margin-bottom: 10px;
}
The margin-bottom value is the size of the spacing.

Change file gbook.php

Find lines 217-229

Code: Select all

echo '</p>
<table border="0" cellspacing="0" cellpadding="2" width="95%" class="entries">';

if ($total == 0) {
	echo '
    <tr>
        <td>No entries yet!</td>
    </tr>
    ';
}
else {printEntries($lines,$start,$end);}

echo '</table>';
and change it to

Code: Select all

echo '</p>
<table border="0" cellspacing="0" cellpadding="2" width="95%" class="entries">';

if ($total == 0) {
	echo '
    <tr>
        <td>No entries yet!</td>
    </tr>
    </table>
    ';
}
else {printEntries($lines,$start,$end);}
Find lines 877-879

Code: Select all

list($name,$from,$email,$url,$comment,$added,$isprivate,$reply)=explode($delimiter,$lines[$i]);
echo '
<tr>
and change it to

Code: Select all

list($name,$from,$email,$url,$comment,$added,$isprivate,$reply)=explode($delimiter,$lines[$i]);
echo '
<table border="0" cellspacing="0" cellpadding="2" width="95%" class="entries"><tr>
Find lines 928-931

Code: Select all

</tr>
';
}
} // END printEntries
and change it to

Code: Select all

</tr></table>
';
}
} // END printEntries
This should be it.
Basically the same as for version 1.43, only a different entry in the stylesheet.

Greetings,
Henrie
jayceegee
Posts: 33
Joined: Sun May 21, 2006 6:33 pm

Post by jayceegee »

:D Wow, that was quick Henrie. Thank you for the response, it works a treat.

Thank you for all the information you have given in other replies, and thank you to Klemen for this superb script. Perhaps in the future, something could be added to the script to enable the line spacing.

Best wishes. Jim.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Hi both,

When I look at it, the extra spacing after each post does look better and it's easier to distinguish between individual entries. I think I'll include this in the next release.

Regards,
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image 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
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

Hi Klemen,

If you decide to do that, it is perhaps a little bit clearer if you change the css file a little.

The entry

Code: Select all

div.centered table {
	margin: 0 auto; 
	text-align: left;
}
at the end as far as i can see applies only to the table.entries and the here in nested table

I think it's better to merge the 'div.centered table' and the 'table.entries' classes to one class 'div.centered table.entries' like this:

Code: Select all

div.centered table.entries {
	color : Black;
	font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
	font-size: 11px;
	BORDER-RIGHT: #23559C 1px solid;
	BORDER-LEFT: #23559C 1px solid;
	BORDER-TOP: #23559C 1px solid;
	BORDER-BOTTOM: #23559C 1px solid;
	margin: 0px auto 10px auto; /* margin: top right bottom left; */
}
I left out the entry text-align: left; because it was not needed as far as i could see (text-alignment is set in the body, td entry.
Further I changed the margin statement to have separate entries for top right bottom left entries to have more control.

Greetings,
Henrie
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Thanks, will use that and get back to you if I need any help with CSS :)

By the way, the auto IP ban already banned over 400 IP addresses from my demo GBook :shock:
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image 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
Me59
Posts: 49
Joined: Sun Sep 04, 2005 10:40 pm

Post by Me59 »

Yep, much better!
just implemented the xtra space :wink:
verzenden
Posts: 2
Joined: Tue Feb 27, 2007 7:50 pm

Post by verzenden »

I tried Henri's suggested solution to create more space. However it did not work for me. I don't know what I did wrong. Somehow the solution seemed very complicated to me as well. So I tried to come up with an easier solution and did.

Open up Style.CSS and find td.upper tag and add the following properties:

height: 30px;
vertical-align: bottom;
The height will create the space, ( I used 30px but do what you like).
The vertical-align: bottom is to keep the text at the bottom.

I don't know if this is a better solution, but for me it's a much easier solution.

Good luck!
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

hello Verzenden,

Your solution is indeed much easier. However, the entries are not separated with a white line, only the blue line is higher. So the different entries are not visually separated.

In my solution each entry is a separate table and i can change the space between the different tables.

Greetings,
Henrie
verzenden
Posts: 2
Joined: Tue Feb 27, 2007 7:50 pm

Post by verzenden »

Henrie wrote:hello Verzenden,

Your solution is indeed much easier. However, the entries are not separated with a white line, only the blue line is higher. So the different entries are not visually separated.
I came to this same conclusion afterwards. But in my questbook the blue line is white and the background is white as well, so the solution only works great for me, or anyone else who makes the blue dissapear.

You can see the result here: gastenboek.kreij.nl (But now there's only 1 entry)
Me59
Posts: 49
Joined: Sun Sep 04, 2005 10:40 pm

Post by Me59 »

verzenden wrote:...

I don't know if this is a better solution, but for me it's a much easier solution.

Good luck!
na, not really!
Henrie's instruction is a lot of cleaning the code as well.
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

@verzenden
So your solution is maybe easier, but not better. You have to change the colors of the guestbook like you have. You did not mention that in your first post.

So when someone likes the default look of the guestbook your solution is no good. I like to give solutions which stay close to the original guestbook (so maybe Klemen will add them to the default guestbook).

Greetings,
Henrie
Pipedream
Posts: 1
Joined: Tue Jul 31, 2007 12:38 pm

Post by Pipedream »

I do hope that this will be implemented in the next version.

Thanks for a great script.
Post Reply