Be a Supporter!

Wrap Predefined Text?

  • 479 Views
  • 12 Replies
New Topic Respond to this Topic
Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Game Developer
Wrap Predefined Text? 2006-11-12 22:46:57 Reply

How do I wrap predefined text?

DFox
DFox
  • Member since: Aug. 9, 2003
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to Wrap Predefined Text? 2006-11-12 23:01:19 Reply

Please elaborate.

Do you mean with PHP? If so you can use the PHP wordwrap function but really I'm just guessing based on the minimal details you provided...


BBS Signature
different
different
  • Member since: Jul. 8, 2004
  • Offline.
Forum Stats
Member
Level 35
Blank Slate
Response to Wrap Predefined Text? 2006-11-13 06:32:35 Reply

If you're talking about preformatted text, you can use the <pre>TEXT HERE</pre> tags in xhtml. This does rely on you to format the text yourself, so it won't wrap for you.


> twitter.

Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Game Developer
Response to Wrap Predefined Text? 2006-11-13 07:32:36 Reply

Sorry, I don't know much about PHP so I thought that was enough information. I'm talking about word wrapping stuff within a 'pre' tagg in html.

Jessii
Jessii
  • Member since: Feb. 10, 2005
  • Offline.
Forum Stats
Member
Level 36
Movie Buff
Response to Wrap Predefined Text? 2006-11-13 07:40:35 Reply

At 11/13/06 07:32 AM, Snubby wrote: Sorry, I don't know much about PHP so I thought that was enough information. I'm talking about word wrapping stuff within a 'pre' tagg in html.

I don't really understand the point of the <pre> tag because it doesn't do anything but make things ugly. I would stick it in a div layer or you can put it in a table and make the table wrap. Otherwise, just don't use pre tags, they're not really necessary.

different
different
  • Member since: Jul. 8, 2004
  • Offline.
Forum Stats
Member
Level 35
Blank Slate
Response to Wrap Predefined Text? 2006-11-13 09:40:43 Reply

At 11/13/06 07:40 AM, Jessii wrote: I don't really understand the point of the <pre> tag because it doesn't do anything but make things ugly. I would stick it in a div layer or you can put it in a table and make the table wrap. Otherwise, just don't use pre tags, they're not really necessary.

They're good for blocks of code - preserving whitespace, formatting it to look like code - see here:

http://www.linksforflash.com/asmain/basic/asn ame.html


> twitter.

Jessii
Jessii
  • Member since: Feb. 10, 2005
  • Offline.
Forum Stats
Member
Level 36
Movie Buff
Response to Wrap Predefined Text? 2006-11-13 10:59:08 Reply

At 11/13/06 09:40 AM, different wrote: http://www.linksforflash.com/asmain/basic/asn ame.html

Yeah but that's all it's really good for. If that's what it's going to be used for, stick it in a div and it'll be ok. If you're going to be using proper line breaks like the example above, then the text won't fall off of the page.

Claxor
Claxor
  • Member since: Oct. 21, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to Wrap Predefined Text? 2006-11-13 11:15:27 Reply

At 11/13/06 10:59 AM, Jessii wrote: Yeah but that's all it's really good for. If that's what it's going to be used for, stick it in a div and it'll be ok. If you're going to be using proper line breaks like the example above, then the text won't fall off of the page.

Well, there's a problem. If you have very long strings, like aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa, they will fuck up your layout (though I think Newgrounds adds linebreaks anyway). The reason wordwrap isn't useful here is that it may cut straight though html-tags, fucking your text up even more :O


BBS Signature
Afro-Ninja
Afro-Ninja
  • Member since: Mar. 2, 2002
  • Offline.
Forum Stats
Moderator
Level 44
Game Developer
Response to Wrap Predefined Text? 2006-11-13 11:23:02 Reply

for my forum I check each word of each post for character length (excluding tags since those will be parsed smaller than the raw html) and if any of the words is over X characters long (the max characters a div can support without stretching) it throws an error


BBS Signature
Jessii
Jessii
  • Member since: Feb. 10, 2005
  • Offline.
Forum Stats
Member
Level 36
Movie Buff
Response to Wrap Predefined Text? 2006-11-13 11:23:03 Reply

At 11/13/06 11:15 AM, Claxor wrote: Well, there's a problem. If you have very long strings, like aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaa, they will fuck up your layout (though I think Newgrounds adds linebreaks anyway). The reason wordwrap isn't useful here is that it may cut straight though html-tags, fucking your text up even more :O

That's why I'm saying that you use the pre tags, you have to automatically add line breaks depending on how long the string is and then you can just put it back together.

Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Game Developer
Response to Wrap Predefined Text? 2006-11-13 16:13:16 Reply

The reason I am using pre tags is because I want to not let people hack me by just posting html taggs and open notes. It's for the Content Reviews on my website.

Jessii
Jessii
  • Member since: Feb. 10, 2005
  • Offline.
Forum Stats
Member
Level 36
Movie Buff
Response to Wrap Predefined Text? 2006-11-13 17:59:33 Reply

At 11/13/06 04:13 PM, Snubby wrote: The reason I am using pre tags is because I want to not let people hack me by just posting html taggs and open notes. It's for the Content Reviews on my website.

Then use the htmlspecialchars() function...

Oh and Snubs, your site is too wide for my 800px resolution @ work :(

Snubby
Snubby
  • Member since: Dec. 4, 2004
  • Offline.
Forum Stats
Member
Level 21
Game Developer
Response to Wrap Predefined Text? 2006-11-14 17:05:13 Reply

Thanks faux I fixed it!