Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forum Coding - Replacing Single Break 1

Status
Not open for further replies.

BFreshour

Programmer
Mar 20, 2002
84
Code:
I currently have a forum written in ColdFusion using a SQL 2000 database.  I'm storing the post as 'Text' with a length of 16.  Whenever display the post back to the user I'm using #ParagraphFormat(PostBody)# which works great.  However if the user enters information such as:

1
2
3
4

The post is played as "1 2 3 4" instead of:

1
2
3
4

The problem has to deal with the ParagraphFormat function in ColdFusion.  It doesn't support single line breaks becase it doesn't know if the next line is a new paragraph or part of the previous one.  Is there ANYWAY to do a find/replace on the PostBody and replace any CRLF with a <br> since HTML is allowed in my forums?

Thanks in advance.

Note:  If the user enters two carriage retuns between a list, such as:

1

2

3

4

it comes out looking just like they put it in.
 
Code:
#Replace(PostBody,chr(10),&quot;<BR>&quot;,&quot;ALL&quot;)#

If that doesn't work, change 10 to 13...
 
They both work, is there any particular one I should use over the other? Meaning is it saver to use chr(10) than chr(13)?
 
Well they can leave weird characters in the database so the best way is...

Code:
Replace(Replace(PostBody,chr(10),&quot;<BR>&quot;,&quot;ALL&quot;),chr(13),&quot;&quot;,&quot;ALL&quot;)#

Hey, mind voting my post helpful?
 
What if I'm performing the action when displaying to the user, not before putting it into the database?
 
I haven't found any difference but the last code I posted doesn't hurt to run it.. then there's no funkiness...

Funkiness.. is that a word?

Tony
 
It is if you want it to be. Thanks for your help.

Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top