johnwayne77 Posted February 20, 2009 Share Posted February 20, 2009 this is my problem: http://www.phpfreaks.com/forums/index.php/topic,238956.0.html i tried the wordwrap but it didn't help me anyone guru on that subject? it really screws up my project Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 20, 2009 Share Posted February 20, 2009 Ok, yeah I think wordwrap function is really only good when you are trying to keep a sentence to a minimal and wrapping the extra words to the next line. Your issue is that you have ONE word that is long.. I don't think wordwrap function will breakup your text....am I correct? Use this: ### Start StringTrim $string_count = strlen($name); if($string_count > 32) { $new_name = substr("$name", 0, 29); $new_name .= "..."; $name = $new_name; } ### End StringTrim You can set the "32" to whatever you want. And the "29" gives you the three dots (...) Quote Link to comment Share on other sites More sharing options...
johnwayne77 Posted February 20, 2009 Author Share Posted February 20, 2009 well, that's what i want: the extra characters to brake up on the next line and so on. i already truncate the text to a specific length.. i got this solution: $string="7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777"; $row=chunk_split($string,50); echo("<table><tr><td width='100'>".$row.";</td></tr></table>"); what do you say? Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 20, 2009 Share Posted February 20, 2009 well, that's what i want: the extra characters to brake up on the next line and so on. i already truncate the text to a specific length.. i got this solution: $string="7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777"; $row=chunk_split($string,50); echo("<table><tr><td width='100'>".$row.";</td></tr></table>"); what do you say? If it works for you I say go for it!! Quote Link to comment Share on other sites More sharing options...
johnwayne77 Posted February 20, 2009 Author Share Posted February 20, 2009 ok, this works: $newtext = wordwrap($titlurez, 8, "\n", true); is better than chunk_split Quote Link to comment Share on other sites More sharing options...
allworknoplay Posted February 20, 2009 Share Posted February 20, 2009 ok, this works: $newtext = wordwrap($titlurez, 8, "\n", true); is better than chunk_split Great! You fixed your own issue! 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.