widget Posted November 26, 2007 Share Posted November 26, 2007 Hi, I would like some help on how to incorporate wordwrap in the code below. I've tried a few different ways but as a newb I just stuff it up. $getShops[shop_desc] = strip_tags(substr("$getShops[shop_desc]", 0, 350), " <b><br><a><img><font>"); $getShops[shop_desc] .= "..."; Quote Link to comment Share on other sites More sharing options...
widget Posted November 26, 2007 Author Share Posted November 26, 2007 Does it go in the output or would I put it on the input form? Still need help with this please Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 26, 2007 Share Posted November 26, 2007 You could use the PHP function wordwrap() http://us.php.net/wordwrap Quote Link to comment Share on other sites More sharing options...
widget Posted December 1, 2007 Author Share Posted December 1, 2007 That link is where I started but Im not sure where it has to go in relation to my code above Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 1, 2007 Share Posted December 1, 2007 Okay...then explain what you want when you say "wordwrap". Quote Link to comment Share on other sites More sharing options...
revraz Posted December 1, 2007 Share Posted December 1, 2007 Where do you want the wordwrap to be located at? Does it go in the output or would I put it on the input form? Still need help with this please Quote Link to comment Share on other sites More sharing options...
widget Posted December 16, 2007 Author Share Posted December 16, 2007 well users can edit their own profile and shop pages. Sometimes people put a continuous string of characters such as hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhi and it breaks the page layout. I would like to have long strings of text automatically broken up. This is my current code which outputs the data. $getShops[shop_desc] = strip_tags(substr("$getShops[shop_desc]", 0, 350), " <b><br><a><img><font>"); $getShops[shop_desc] .= "..."; When trying to implement word wrap (see example I found below) <?php $text = "A very long woooooooooooord."; $newtext = wordwrap($text, 8, "\n", true); echo "$newtext\n"; ?> How would i incorporate this into my code above? Or does the wordwrap code need to go in the form the user uses to enter their descriptions or does it get melded into my original code above? Its hard to explain Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.