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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building a simple message board. Have a small problem

Status
Not open for further replies.

Twizz

Technical User
Mar 10, 2004
3
SE
Hi

I've built a simple message board that uses a text area to submit posts.

Everything works just fine except the text formatting when I present the posts.

At first I was just loading the text from the database and presented it as is in a TD element with no text formatting. I then wanted to make the text look the way it did when it was posted so I inserted the pre element. This works as long as people hit enter every now and then, but if they don't. The table will be stretched out no matter what width I set for the TD and table. Now I want to force a line break or set a max width for the post. I've tried messing around with style and such but it doesn't do anything.

Is there anyway to do this? or is there another work-around?

I'll show the layout of the table I use below just to clear things up a bit. This isn't the excact code I use but very close (I use another language...)

Code:
<table border="1" width="800">
<tr>
<td><strong>Submitted by: </center> <% =RecSet("User") %> </td>
</tr>
<tr>
<td> <strong>Subject: </strong> <% =RecSet("Subject") %> </td>
</tr>
<tr>
<td width="750"><pre><% =Recset("content") %> </pre> </td>
</tr>
<table>
{/code}
It's the line with RecSet("content") I want to force linebreaks on.

Is there an easy way to do this or do I need to write a function that splits the string up in words and insert <br> at some points?

This might be more of a HTML/CSS question but wasn't sure where to post.



 
You can try this
Code:
<td width="750"><%=Replace(Recset("content"),vbCrLf,"<br>") %></td>

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Thanks a lot. That worked.

Didn't know that constant. It's a nice one to know and I found some ohter while looking up what it did :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top