Re: About Guest Book\'s messages....
| From: | Jason k Larson | Date: | Wed, 28 May 2003 09:24:35 +0000 |
| Subject: | Re: About Guest Book\'s messages.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149203@lists.php.net to get a copy of this message | ||
Greetings,
How about some simple word detection attempts like:
$words = explode (' ',$input); //create array
$new_words = ''; //empty
foreach ($words as $word)
{
if (strlen ($word) <= 40)) { $word = wordwrap ($word,40,"\n",1); }
$new_words .= ' '.$word; //add word(s) to string
}
$new_words = trim ($new_words); //kill excess spaces
So the idea here is to check each supposed word for it's length, if its a long word,
longer than 40 characters, break it up. This should leave the smaller and hopefully real
words away from the wordwrap-ing.
note that this is completely untested, I just wrote it here in email.
Hope that helps.
--
Jason k Larson
fongming wrote:
Hi, Sir: There may be someone leave a message like following: UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU and it expand the width of the table on my web page and make pages ugly.... I used wordwrap($word,40,"\n",1) to prevent it, but my system is BIG5 ,two bytes, Sometimes this method would destroy the structure of the two-bytes word. Any one has good ideas and could help me with that ? Thanks........ ----------------------------------- Fongming from Taiwan. ------------------------------------------ ¡»From: ¦¹«H¬O¥Ñ®ç¤p¹q¤l¶l¥ó1.5ª©©Òµo¥X... http://fonn.fongming.idv.tw fongming@fonn.fongming.idv.tw