Stop Microsoft
Miscellaneous => Programming & Networking => Topic started by: LorKorub on 26 November 2002, 16:40
-
I wrote my own guestbook script for a friend's web site I am doing, but I cannot seem to format the text from a textbox to get it to output properly on the "view guestbook" screen. It writes on only one line, and pressing Return, Tab, etc. have no effect.
I tried adjusting the column width on the output table, but no effect either...
Any suggestions?
-
You'll need to replace the newline characters in the text with <br>
-
cant you replace it with the php with a /n ?
(i dont know... i am asking)
-
After pulling my guestbook comments from the database here is what I do to insert a <BR> wherever there is a return:
-
Thanks guys...
void: Your function worked, but since PHP 4.0+ they have come up with something much easier to use. It is called the nl2br function. Easy:
<?
$text=mysql_result($blah,$i,"blah");
$new_text=nl2br($text);
?>
Then just call $new_text where you want to use it, or pass whatever variable you want to nl2br and call it directly.
-
Cool, less typing. I think I have all of my servers upgraded to 4+ now. Guess I'll have to do some changes on the BS guestbook. (http://smile.gif)
-
void you should release source for all your stuff.
-
I'll clean up the guestbook stuff and tar/gz it up and put it in the files section while recovering from my turkey dinner tomorrow (today). I have other stuff out there already (not on the voidmain site though).
I'm sure there are better guest books out there. That is something I hacked up in a couple of hours one day and it's functional so I use it. I'll put up some code for a database driven links page as well. Another 1 or 2 hour incarnation. Maybe some of you guys can add to it and make it much better. When I write stuff for myself I usually just do the bare minimum (as you can probably tell).
-
quote:
Originally posted by void main:
I'll clean up the guestbook stuff and tar/gz it up and put it in the files section while recovering from my turkey dinner tomorrow (today). I have other stuff out there already (not on the voidmain site though).
I'm sure there are better guest books out there. That is something I hacked up in a couple of hours one day and it's functional so I use it. I'll put up some code for a database driven links page as well. Another 1 or 2 hour incarnation. Maybe some of you guys can add to it and make it much better. When I write stuff for myself I usually just do the bare minimum (as you can probably tell).
Or I can just give you the source code to what I use. But you know how to do it yourself =\
-
I can give you the source code for mine if you want. Mine is pretty much like void main's, minus the URL part (but I can put that in for you if you'd like.)
It's really easy. I did mine in a few hours. Just got snagged on the text-formatting.
-
Yeah, maybe yours or Quirk's would be the way to go. I haven't had time to clean up the code and package it up. I'm working on a new RedHat tip for the site at the moment, and trying to get 2.5.50 to compile.