Jump to content

Recommended Posts

Posted

Hiya, I'm searching all over the web trying to find a tag that's similar to PRE, as in, it preserves all line breaks as you type them, but still wraps and displays in a variable-width font (shouldn't affect anything other than line breaks).

 

Even if there's not a tag to do that, does anyone know any css that would handle that for me? Anything? ARgh, I don't want to have to go re-write all these pages!

Posted

LunarMagic,

 

It may just be me - it's getting towards the end of the day over here, but I'm not sure what effect you are after, have you got an example on your site of what is not working? and can you provide an example of what you want to do?

 

Andy

Posted

Yes, sure thing. =)

 

Basically, like this forum... you type in this message like this. you don't add in any BR or P tags to your text here.

 

When it posts, it posts with the paragraph spacing exactly as you type it in.

This is on one line.

This is on another.

 

I have a form on my site (can't show you, it's part of a script for members, log in only, etc). And when they type in their information, it displays like this:

 

When it posts, it posts with the paragraph spacing exactly as you type it in.This is on one line.This is on another.

 

Soooo, I need some sort of "parser" or script that will take a text field such as this, and make sure it displays with the line breaks intact...

Posted

If you're into PHP, take a look at these two functions and experiment with them:

 

nl2br -- Inserts HTML line breaks before all newlines in a string

 

htmlentities -- Convert all applicable characters to HTML entities (turns stuff like 'á' into 'á' )

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...