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