
11-02-04, 12:52 PM
|
|
Junior Code Guru
|
|
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
bb codes?
i have a problem with showing the posted messages 'as written'.. here if i press enter
the line changes
but only way i have got the line to change is by makeing the user type [br] witch is not good.. i use a textarea that is slashed (addslashes()) and inserted.. then to show it i unslash (stripslashes()) it and just echo..
anyone know how its done or what i do wrong?
thanks
Wille
|

11-02-04, 01:08 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
use the function 'nl2br()' in the code for show message.
__________________
<a href=http://www.w3cweb.com>http://www.w3cweb.com</a>
Last edited by rongge; 11-02-04 at 01:32 PM.
|

11-02-04, 01:20 PM
|
|
Banned
|
|
Join Date: Jun 2004
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
this replaces new lines and returns with <br>, great isnt it.
|

11-02-04, 01:48 PM
|
 |
Coding Addict
|
|
Join Date: May 2004
Location: Long Island, New York
Posts: 356
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
BTW if you gonna use 4n7hr4x's cide on a windows machine use this:
also it's a backslash not a foward.
|

11-02-04, 05:43 PM
|
|
Banned
|
|
Join Date: Jun 2004
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
either way works fine, eclipse is just one line shorter,
|

11-02-04, 06:08 PM
|
|
Newbie Coder
|
|
Join Date: Oct 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Uh, actully your method would make it double <br> on windows.
|

11-02-04, 06:09 PM
|
|
Banned
|
|
Join Date: Jun 2004
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i have never used windows, good to know.
|

11-02-04, 09:02 PM
|
|
Junior Code Guru
|
|
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
this replaces new lines and returns with <br>, great isnt it.
|
Quote:
|
either way works fine, eclipse is just one line shorter,
|
eclipse way is ok. but it won't work when the browser is *NIX compliant. it's safer to change only "\n" into '<br />' and then strip the rest "\r" for cross browser compatibility.
about your way 4n7hr4x, i just ask, have you tested it before? since the character "r/" and "/n" do not exist in ASCII table, the character won't be replaced except there is either literal 'r/' and '/n' in the string. (which is contrary to what is expected).
regards,
__________________
just an ignorant noob with moronic solution...
|

11-03-04, 01:31 PM
|
|
Banned
|
|
Join Date: Jun 2004
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes, I use it on my site 
|

11-03-04, 02:56 PM
|
 |
Coding Addict
|
|
Join Date: May 2004
Location: Long Island, New York
Posts: 356
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
|
Originally Posted by Deekay
Uh, actully your method would make it double <br> on windows.
|
Well it has worked for me on my windows server.....

|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|