Re: [PHP] wrapping text

2005-08-13 Thread Jasper Bryant-Greene

John Taylor-Johnston wrote:
Folks are complaining mail arrives and text will not wrap. $message 
comes directly from a textarea. Old mail readers, I guess?

How can I make their life better and make the text wrap?


http://www.php.net/wordwrap

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Wrapping text output

2003-03-21 Thread Sebastian
$my_data = wordwrap( $my_data, 50 );
http://www.php.net/manual/en/function.wordwrap.php

it'll wrap after 50 charcters... change 50 to what you want it to start
wrapping at. If $my_data is inside a table it should wrap the text
automatically unless you tell the table not to wrap ..

cheers,
- Sebastian

- Original Message -
From: Philip J. Newman [EMAIL PROTECTED]


| $my_data = This is a really long string that could go on for ever and
ever
| and ever and ever and ever and ever and ever and ever and ever and ever
and
| ever and ever and ever and don't wrap to my table it makes it bigger;
|
| echo $my_data;
|
| How can I make this wrap to the table?
|
|
| --
| Philip J. Newman.
| Head Developer
| [EMAIL PROTECTED]
|
|
|
| --
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, visit: http://www.php.net/unsub.php
|


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Wrapping text output

2003-03-21 Thread Justin French
on 22/03/03 3:57 PM, Philip J. Newman ([EMAIL PROTECTED]) wrote:

 $my_data = This is a really long string that could go on for ever and ever
 and ever and ever and ever and ever and ever and ever and ever and ever and
 ever and ever and ever and don't wrap to my table it makes it bigger;
 
 echo $my_data;
 
 How can I make this wrap to the table?

Er:

table width=330
trtd?=$my_data?/td/tr
/table

This text will wrap inside a table, according to every browser I've ever
used.

If you want to wrap for other purposes, eg email or raw text, then

$my_data = wordwrap($my_data,65);

will word-wrap at 65 characters, which is pretty pointless with variable
width fonts, but okay with fixed width fonts.


Justin


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Wrapping Text

2002-04-28 Thread John Holmes

Wordwrap() might be a good solution for you, but it's probably more of a
table design issue. The table needs some whitespace to break to a new
line. If you are putting in a string of img...img...img...
etc..then there's no where to break. Try putting a space before or after
the img... when you replace the :P with it. 

And for the replacing, if the user does not edit the post, then do the
conversion when they submit it. If they do edit it, then do it at run
time. If there is editing involved, you want to present the text back to
the user in the same format as they typed it, or otherwise they'll get
confused. If there is no editing, then you'll save processor time by
only doing the conversion once, instead of for every view.

---John Holmes...

 -Original Message-
 From: Scott Reismanis [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, April 27, 2002 11:58 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Wrapping Text
 
 Hi PHP digest readers.
 
 Ok I have a problem and a question which I am certain many share and
 even a solution to my problem, however I wish to hear how you dealt
with
 this issue to see if there is a better method.
 
 Ok for my problem, it is regarding a smilie system. Currently what
 happens is if people post :P:P:P:P:P:P etc.. etc.. then the text field
 expands to an ugly length. My current solution which I don't really
like
 is to limit the number of smiles which a person is allowed to use. Can
 anyone propose a better solution than this? i.e. wrap them using PHP
or
 maybe I coded my html poorly which is why my table is expanding?
 
 Secondly my question on a similar note whether to convert smilies at
 runtime, or when a person submits a post? The beneifits at runtime is
 less space used in the DB, and no worring about converting the
converted
 post back when it is needed to be edited, however with this method the
 server has to do more processing in converting smilies each time the
 post is viewed and vise versa.
 
 Thanks for your time, and I anticipate any light which can be shed on
 this issue.
 
 Scott


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: RE: [PHP] Wrapping Text

2002-04-28 Thread Scott Reismanis

Sorry I wasn't exactly clear on my explaination. I believe it is a 
table design issue because i tried putting spaces between the image 
tags. i.e. img ... img ... img ... img ... etc... and the table 
was still been stretched. my solution has since been to force a br 
(using wordwrap) but I would rather force a space which i can do but 
this does not seem to cause the streching to stop. I guess it is my 
tables as my site is designed to fit any res and as such does not have 
set pixel width tables. back to the drawing board for me then i guess :)

cheers for the suggestion

- Original Message -
From: John Holmes [EMAIL PROTECTED]
Date: Monday, April 29, 2002 3:36 am
Subject: RE: [PHP] Wrapping Text

 Wordwrap() might be a good solution for you, but it's probably 
 more of a
 table design issue. The table needs some whitespace to break to a new
 line. If you are putting in a string of img...img...img...
 etc..then there's no where to break. Try putting a space before or 
 afterthe img... when you replace the :P with it. 
 
 And for the replacing, if the user does not edit the post, then do the
 conversion when they submit it. If they do edit it, then do it at run
 time. If there is editing involved, you want to present the text 
 back to
 the user in the same format as they typed it, or otherwise they'll get
 confused. If there is no editing, then you'll save processor time by
 only doing the conversion once, instead of for every view.
 
 ---John Holmes...
 
  -Original Message-
  From: Scott Reismanis [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, April 27, 2002 11:58 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Wrapping Text
  
  Hi PHP digest readers.
  
  Ok I have a problem and a question which I am certain many share and
  even a solution to my problem, however I wish to hear how you dealt
 with
  this issue to see if there is a better method.
  
  Ok for my problem, it is regarding a smilie system. Currently what
  happens is if people post :P:P:P:P:P:P etc.. etc.. then the text 
 field expands to an ugly length. My current solution which I 
 don't really
 like
  is to limit the number of smiles which a person is allowed to 
 use. Can
  anyone propose a better solution than this? i.e. wrap them using PHP
 or
  maybe I coded my html poorly which is why my table is expanding?
  
  Secondly my question on a similar note whether to convert 
 smilies at
  runtime, or when a person submits a post? The beneifits at 
 runtime is
  less space used in the DB, and no worring about converting the
 converted
  post back when it is needed to be edited, however with this 
 method the
  server has to do more processing in converting smilies each time the
  post is viewed and vise versa.
  
  Thanks for your time, and I anticipate any light which can be 
 shed on
  this issue.
  
  Scott
 
 


Powered by telstra.com

 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: RE: [PHP] Wrapping Text

2002-04-28 Thread John Holmes

It should have a % for the width at least, and then it should wrap
itself.

---John Holmes...

 -Original Message-
 From: Scott Reismanis [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, April 28, 2002 7:42 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: RE: [PHP] Wrapping Text
 
 Sorry I wasn't exactly clear on my explaination. I believe it is a
 table design issue because i tried putting spaces between the image
 tags. i.e. img ... img ... img ... img ... etc... and the
table
 was still been stretched. my solution has since been to force a br
 (using wordwrap) but I would rather force a space which i can do but
 this does not seem to cause the streching to stop. I guess it is my
 tables as my site is designed to fit any res and as such does not have
 set pixel width tables. back to the drawing board for me then i guess
:)
 
 cheers for the suggestion
 
 - Original Message -
 From: John Holmes [EMAIL PROTECTED]
 Date: Monday, April 29, 2002 3:36 am
 Subject: RE: [PHP] Wrapping Text
 
  Wordwrap() might be a good solution for you, but it's probably
  more of a
  table design issue. The table needs some whitespace to break to a
new
  line. If you are putting in a string of img...img...img...
  etc..then there's no where to break. Try putting a space before or
  afterthe img... when you replace the :P with it.
 
  And for the replacing, if the user does not edit the post, then do
the
  conversion when they submit it. If they do edit it, then do it at
run
  time. If there is editing involved, you want to present the text
  back to
  the user in the same format as they typed it, or otherwise they'll
get
  confused. If there is no editing, then you'll save processor time by
  only doing the conversion once, instead of for every view.
 
  ---John Holmes...
 
   -Original Message-
   From: Scott Reismanis [mailto:[EMAIL PROTECTED]]
   Sent: Saturday, April 27, 2002 11:58 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] Wrapping Text
  
   Hi PHP digest readers.
  
   Ok I have a problem and a question which I am certain many share
and
   even a solution to my problem, however I wish to hear how you
dealt
  with
   this issue to see if there is a better method.
  
   Ok for my problem, it is regarding a smilie system. Currently what
   happens is if people post :P:P:P:P:P:P etc.. etc.. then the text
  field expands to an ugly length. My current solution which I
  don't really
  like
   is to limit the number of smiles which a person is allowed to
  use. Can
   anyone propose a better solution than this? i.e. wrap them using
PHP
  or
   maybe I coded my html poorly which is why my table is expanding?
  
   Secondly my question on a similar note whether to convert
  smilies at
   runtime, or when a person submits a post? The beneifits at
  runtime is
   less space used in the DB, and no worring about converting the
  converted
   post back when it is needed to be edited, however with this
  method the
   server has to do more processing in converting smilies each time
the
   post is viewed and vise versa.
  
   Thanks for your time, and I anticipate any light which can be
  shed on
   this issue.
  
   Scott
 
 
 
 
 Powered by telstra.com
 
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: RE: [PHP] Wrapping Text

2002-04-28 Thread Jason Wong

On Monday 29 April 2002 01:53, John Holmes wrote:
 It should have a % for the width at least, and then it should wrap
 itself.

Not necessarily, if you have a single 'word' (a string of characters with no 
space) that is very long then the width of the table stretches to accomodate 
the length of that 'word'.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
There's no easy quick way out, we're gonna have to live through our
whole lives, win, lose, or draw.
-- Walt Kelly
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: RE: [PHP] Wrapping Text

2002-04-28 Thread John Holmes

  It should have a % for the width at least, and then it should wrap
  itself.
 
 Not necessarily, if you have a single 'word' (a string of characters
with
 no
 space) that is very long then the width of the table stretches to
 accomodate
 the length of that 'word'.

Right, that's why I told him to put a space around his image tags. Then,
with that space, and a % width, it should (?) wrap. 

I think he was ending up with a long 'word' like you were saying; only
made of image tags.

img src='foo.jpg'img src='foo.jpg'img src='foo.jpg' etc...

so it would not wrap. 

img src='foo.jpg' img src='foo.jpg' img src='foo.jpg' etc...

should wrap, though. 

---John Holmes...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] wrapping text on a page display.

2001-05-21 Thread Floyd Baker

On Mon, 21 May 2001 12:57:13 -0400, you wrote:



Hello..  Sorry, I know this is a constant problem.., at least for me.

Now I am using 'text' to store big inputs.  It does not wrap on the
screen display...   

I have it working on my machine with wordwrap with php4.
The isp does not have php4 yet, and it doesn't work with I upload.

What is the php3 alternative please?

The ascii between the ;'s is exactly this... One long line.

;I\'ll add details later.  Now is the time for all good men to come to
the aid of their country...  The quick brown fox jumped over the lazy
dogs back 12345 times...  Of all the fishes in the sea, the mermaid is
still the only one for me;


I am using include() on a net fusion .php3 page to pull the php script
to pull and print the text field.

Thanks. 

Floyd



You know there's an extra } in the first example for word wrap, under
string functions in the manual..I'm still having trouble with it
so I'd like someone else to take a crack at it too.  

Thanks..

Floyd



--


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Wrapping text to store in the database

2001-05-08 Thread Jack Dempsey

check http://www.php.net/manual/en/function.nl2br.php
you could also do a regex, searching for \n, and adding a P to it...adding
the /P would make it a little more difficult...

-jack
-Original Message-
From: Romulo Roberto Pereira [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 08, 2001 1:09 PM
To: Php-General
Subject: [PHP] Wrapping text to store in the database


Hello!

If a user drop a text like this in a textarea:

---
the U.S. Army's 3rd Infantry Division, 15th Regiment, A Company, seized a
44-car train in a tunnel 60 miles south of Salzburg, Austria. It contained
an incalculable fortune in fine art, bullion, jewelry, furs, coins, stamp
collections, cameras, china, linens, silver, Oriental rugs, furniture, and
anything else of value that a pro-Nazi Hungarian government looted from
Jewish households during World War II.

The Nazis, who surrendered on May 8, 1945, had been hoping to send the goods
westward toward Germany ahead of the Russian advance.

It never made it.

But neither did its contents revert to those who lost them, nor were they
compensated, despite U.S. policy dictating that anything identifiable be
returned to its nation of origin.

U.S. officials decided that the train's booty couldn't be traced to
Hungary's Jews, and over the Hungarian Jewish community's fierce protests,
sold it at auction, at military exchanges, used it in government offices and
officials' homes, and in some cases, simply stole it.
---

As you can see the text is simple and there are not any html tags. How do I
do to add this elements so the text become something like this below, I mean
how to wrap it up in html tags?

---
pthe U.S. Army's 3rd Infantry Division, 15th Regiment, A Company, seized a
44-car train in a tunnel 60 miles south of Salzburg, Austria. It contained
an incalculable fortune in fine art, bullion, jewelry, furs, coins, stamp
collections, cameras, china, linens, silver, Oriental rugs, furniture, and
anything else of value that a pro-Nazi Hungarian government looted from
Jewish households during World War II./p

pThe Nazis, who surrendered on May 8, 1945, had been hoping to send the
goods westward toward Germany ahead of the Russian advance./p

pIt never made it./p

pBut neither did its contents revert to those who lost them, nor were they
compensated, despite U.S. policy dictating that anything identifiable be
returned to its nation of origin./p

pU.S. officials decided that the train's booty couldn't be traced to
Hungary's Jews, and over the Hungarian Jewish community's fierce protests,
sold it at auction, at military exchanges, used it in government offices and
officials' homes, and in some cases, simply stole it./p
---

Ideas?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Wrapping text to store in the database

2001-05-08 Thread Don Read


On 08-May-01 Romulo Roberto Pereira wrote:
 Hello!
 
 If a user drop a text like this in a textarea:


snip
 
 ---
 
 As you can see the text is simple and there are not any html tags. How do I
 do to add this elements so the text become something like this below, I mean
 how to wrap it up in html tags?
 
snip again
 
 Ideas?

nl2br()

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Wrapping Text

2001-04-07 Thread shaun

one thing that would help is to str_replace("\n", "br");

I think textarea has a wrap attribute doesn't it?



On Wednesday 04 April 2001 13:20, Chris Anderson wrote:
 I've been having large problems with this so I decided to ask you guys(and
 gals ^_^). I have a textarea where you can type your text and it is saved
 to a file. Then another script includes that. Unfortunately I can't find a
 way for the textarea to wrap the text, or make it so it shows it they way
 they typed it in. Any help would be appreciated

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Wrapping Text

2001-04-07 Thread Philip Olson

Or better yet, use nl2br() :

  http://www.php.net/manual/en/function.nl2br.php

Regarding the html WRAP attribute, this little tutorial looks 
interesting :

  http://www.web-wise-wizard.com/html-tutorials/
 html-form-forms-textarea-wrap.html

(note: it's one link, had to split up as it's so long!)

Regards,
Philip


On Sat, 7 Apr 2001, shaun wrote:

 one thing that would help is to str_replace("\n", "br");
 
 I think textarea has a wrap attribute doesn't it?
 
 
 
 On Wednesday 04 April 2001 13:20, Chris Anderson wrote:
  I've been having large problems with this so I decided to ask you guys(and
  gals ^_^). I have a textarea where you can type your text and it is saved
  to a file. Then another script includes that. Unfortunately I can't find a
  way for the textarea to wrap the text, or make it so it shows it they way
  they typed it in. Any help would be appreciated
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]