daoverseer1
Joined: Apr 14, 2004
# Posts: 6
|
Posted: 2004-Apr-15 04:34
I have configured a guestbook.pl for my website...and it works great except for one little thing. When you type something in the comments box that ends up being a few lines long....and then click submit.....the posting displays the comments as one long line rather than wrapping them around into several lines....which then causes a scroll bar to appear at the bottom and you have to keep scrolling to the right to see the whole line. How can I make the comments wrap around to where the lines don't go over let's say 80 characters in length....which would then wrap around to the next line and so forth until it reaches the last letter?? I have been looking all over the internet for this answer. Any help is greatly appreciated.
THANKS!!
|
 |
crash
Staff
Joined: Dec 02, 2003
# Posts: 10626
|
Posted: 2004-Apr-15 05:28
When the comment is posted - does it get posted into a table cell? you need something to tell the comment space how wide it should be, that should force the wrap.
|
 |
Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1788
|
Posted: 2004-Apr-15 11:26
The best way is to reproduce here the part which prints out the HTML page. You are probably using a table to format your page and as crash has pointed out, is the first place to look. Nested tables can be awkward to manage when you are using many tables to effectively render blocks of color without using images.
|
 |
daoverseer1
Joined: Apr 14, 2004
# Posts: 6
|
Posted: 2004-Apr-15 15:05
Thanks Crash and Prowler for responding so quickly. I do not see an HTML table on the output page, but I will definitely look into the code. You both are probably right, I'm sure there is a nested table in there that I have not seen. I did not even think of that. Prowler, I will reproduce the part and paste it in here tonight when I have it available to post. Thanks again guys and I look forward to you both helping me figure out this problem.
|
 |
crash
Staff
Joined: Dec 02, 2003
# Posts: 10626
|
Posted: 2004-Apr-15 16:10
Actually, I was thinking it sounded like he was missing a table. Or has some other stray code telling the line Not to break and wrap.
Prowler is right, we can help way better with the output code to view. Then we don't have to guess
|
 |
daoverseer1
Joined: Apr 14, 2004
# Posts: 6
|
Posted: 2004-Apr-16 05:51
I think this is the output code. If you see that it is not...just let me know and I will try a different section. Again...I thank you both for taking the time to help me out!!!
#######
#Opens 'guestbook.html' for writting
open (FILE,"$directory_gbook" die "Can't Open $directory_gbook: $!n";
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;
# Open Link File to Output
open (GUEST,">$directory_gbook" die "Can't Open $directory_gbook: $!n";
for ($i=0;$i<=$SIZE;$i++) {
$_=$LINES[$i];
if (/<!--add-->/) {
if ($entry eq '1') {
print GUEST "<!--add-->n";
}
print GUEST "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0>n";
if ( $FORM{'name'}) {
print GUEST "<TR><TD><B><font color=#FFFFFF>Name:</font></B></TD> <TD><font color=#FFFFFF>$FORM{'name'} - $date</font></TD></TR>n
";
}
if ($FORM{'email'}) {
print GUEST "<TR><TD><B><font color=#FFFFFF>E-mail:</font></B></TD> <TD><A HREF="mailto:$FORM{'email'}"> $FORM{'email'}</A></TD><
/TR>n";
}
if ($FORM{'url'} ne "http://" {
print GUEST "<TR><TD><B><font color=#FFFFFF>My URL:</font></B></TD> <TD><A HREF=$FORM{'url'}>$FORM{'url'}</A></TD></TR>n";
}
else {
}
if ( $FORM{'city'} ){
print GUEST "<TR><TD><B><font color=#FFFFFF>Location: </font></B></TD> <TD><font color=#FFFFFF>$FORM{'city'}</font>";
print GUEST ", <font color=#FFFFFF>$FORM{'state'} $FORM{'country'}</font></TD></TR>n";
}
print GUEST "<TR><TD VALIGN=top><B><font color=#FFFFFF>Comments: </font></B></TD> n";
print GUEST "<TD><font color=#FFFFFF>$FORM{'comments'}</font></TD></TR></TABLE><P>n";
print GUEST "<CENTER><IMG SRC="$base$gif4"></CENTER><BR>nnn";
if ($entry eq '0') {
print GUEST "<!--add->n";
}
}
else {
print GUEST $_;
}
}
close (GUEST);
|
 |
crash
Staff
Joined: Dec 02, 2003
# Posts: 10626
|
Posted: 2004-Apr-16 16:12
nothing is screaming at me about the table setup - Prowler is way better with the program code than I am so I'll leave that to him
What does the output code look like
posting displays the comments as one long line rather than wrapping them around into several lines Can we see the code where this is happening? I'm assuming it's in a browser but it just occured to me that you could be talking about email. Where are the non-wrapping codes being displayed?
|
 |
Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1788
|
Posted: 2004-Apr-17 08:43
Ok. One quick look shows that you have the table setup as here:
print GUEST "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0>n";
It is better to specify the table width parameter to retain control over the width of the rendered page. So you modify the table like so:
print GUEST "<TABLE width='100%' CELLPADDING=0 CELLSPACING=1 BORDER=0> n";
You may also 'justify' the paragraph of the comments section like this:
print GUEST "<TR><TD VALIGN=top align=left<B><font color=#FFFFFF>Comments: </font></B></TD> n";
print GUEST "<TD align=left><p align='justify'><font color=#FFFFFF>$FORM{'comments'}</font></TD></TR></TABLE><P> n";
Whilst at it, make sure that the code lines do not have any unintentional carriage returns or line breaks which will upset the Perl interpreter resulting in a 500 internal server error.
|
 |
daoverseer1
Joined: Apr 14, 2004
# Posts: 6
|
Posted: 2004-Apr-17 23:58
Thanks Crash & Prowler. I will try your suggestion out prowler and let you know the outcome as soon as I can test it out. I appreciate all your continued help. I have posted to a few forums....but this is the only forum who has offered advice to help me fix this problem. I'll get the results up as soon as I can.
THANKS!!
|
 |
daoverseer1
Joined: Apr 14, 2004
# Posts: 6
|
Posted: 2004-Apr-18 00:17
Unfortunately, nothing changed. Perhaps I haven't posted the right code yet. I have found another section of the code which prints the thank you page and that's actually the page I view when I notice the comments line that keeps on going instead of wrapping around. Perhaps it is somewhere in there. I hate it when I can't figure something out....which makes me even more grateful for your help.
# Print Thank You HTML
print "Content-Type: text/htmlnn";
print "<HTML>n";
print "<TITLE>Thank You</TITLE>n";
print "<BODY BGCOLOR=#000000 ALINK=#FFFFFF LINK=#FFFFFF VLINK=#FFFFFF>n";
print "<CENTER><IMG SRC="$base$gif3"></CENTER><BR>n";
print "<font color=#FFFFFF>Thank you, your entry has been added to our</font>";
print "<A HREF="$guestbook"> guestbook.</A><P>n";
print "<font color=#FFFFFF>Here is what you submitted:</font><P>n";
print "<CENTER><IMG SRC="$base$gif4"></CENTER><BR>n";
if ( $FORM{'name'}) {
print "<B><font color=#FFFFFF>Name:</font></B> <font color=#FFFFFF>$FORM{'name'} - $date<BR></font>n";
}
if ($FORM{'email'}) {
print "<B><font color=#FFFFFF>My E-mail:</font></B> <a href="mailto:$FORM{'email'}"> $FORM{'email'}</a><BR>n";
}
if ($FORM{'url'} ne "http://" {
print "<B><font color=#FFFFFF>My URL:</font></B> <a href=$FORM{'url'}>$FORM{'url'}</a><BR>n";
}
else {
}
if ( $FORM{'city'} ){
print "<B><font color=#FFFFFF>Location: </font></B><font color=#FFFFFF>$FORM{'city'}</font>";
print ", <font color=#FFFFFF>$FORM{'state'} $FORM{'country'}</font><BR>";
}
print "<font color=#FFFFFF><BR><BR><B>Comments:</B>n";
print "$FORM{'comments'}<BR>n";
print "<CENTER><IMG SRC="$base$gif4"></CENTER><BR><BR>n";
print "</font></body></html>n";
exit;
|
 |
crash
Staff
Joined: Dec 02, 2003
# Posts: 10626
|
Posted: 2004-Apr-18 00:54
you've got no html formatting for the output - ah - my kungfu pretty much blows here, you're going to have to wait for prowler to come back sorry!
|
 |
daoverseer1
Joined: Apr 14, 2004
# Posts: 6
|
Posted: 2004-Apr-18 17:10
LOL. No problem Crash. I appreciate you continuing to stop by and checking up on me. Hopefully Prowler will find something.
|
 |
Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1788
|
Posted: 2004-Apr-20 10:58
Ok. Here is what I have done to do some formatting. I have added a table before your comments get printed. This table has 90 % width which with a sample text paragraph turned out well. Here is the modified listing:
# Print Thank You HTML
print "Content-type: text/htmlnn";
print "<HTML>n";
print "<TITLE>Thank You</TITLE>n";
print "<BODY BGCOLOR=#000000 ALINK=#FFFFFF LINK=#FFFFFF VLINK=#FFFFFF>n";
print "<CENTER><IMG SRC="$base$gif3"></CENTER><BR>n";
print "<font color=#FFFFFF>Thank you, your entry has been added to our</font>";
print "<A HREF="$guestbook"> guestbook.</A><P>n";
print "<font color=#FFFFFF>Here is what you submitted:</font><P>n";
print "<CENTER><IMG SRC="$base$gif4"></CENTER><BR></td><td>n";
if ( $FORM{'name'}) {
print "<B><font color=#FFFFFF>Name:</font></B> <font color=#FFFFFF>$FORM{'name'} - $date<BR></font>n";
}
if ($FORM{'email'}) {
print "<B><font color=#FFFFFF>My E-mail:</font></B> <a href="mailto:$FORM{'email'}"> $FORM{'email'}</a><BR>n";
}
if ($FORM{'url'} ne "http://" {
print "<B><font color=#FFFFFF>My URL:</font></B> <a href=$FORM{'url'}>$FORM{'url'}</a><BR>n";
}
if ( $FORM{'city'} ){
print "<B><font color=#FFFFFF>Location: </font></B><font color=#FFFFFF>$FORM{'city'}</font>";
print ", <font color=#FFFFFF>$FORM{'state'} $FORM{'country'}</font><BR>";
}
print "<table width='90%' border='0'><tr><td valign='top'><p align='justify'><font color=#FFFFFF><BR><BR><B>Comments:</B>n";
print "$FORM{'comments'}<BR>n";
print "</p></td></tr></table><CENTER><IMG SRC="$base$gif4"></CENTER><BR><BR>n";
print "</font></body></html>n";
exit;
This is mearly intended to show how one can manipulate the formatting.
|
 |
Prowler
Staff
Joined: Aug 14, 2000
# Posts: 1788
|
Posted: 2004-Apr-20 11:02
Sorry about the delay. We live in different time zones and I get to see the action here only at the end of the day - my day.
|
 |