I'm currently working on a personal side-project and I would like to know how to get a text box to keep its width without expanding itself because some idiot has not learnt how to use the space bar. I've also found this problem on killablogs if someone posts a long comment it would turn out to be something similar to
[img]http://www.frozenplague.net/img/phpspam.png[/img]
As you can see by this screenshot, it pushes the content over to the right and "defaces" the site. Is there a way to get the php to recognise that the word is too long to belong in the english language and insert a <br> somewhere? So instead of lollollollollollollollollollollollollollollollollollollollollol you would have
lollollollollollollollollollollollol
lollollollollollollollollollollollol
Text Overflow
Moderators: Moderator, Global Moderator
Text Overflow
[color=\"green\"]well...if you can work out how to define $string properly <img src=\'http://www.killanet.net/forum3/public/s ... >/blum.gif\' class=\'bbc_emoticon\' alt=\':P\' /> ..this should work <img src=\'http://www.killanet.net/forum3/public/s ... iggrin.gif\' class=\'bbc_emoticon\' alt=\':D\' />
[code]<?
$Length = 5;
$string = \'blog_post\';
if(strlen($string) > $Length){
preg_match(\'/[a-zA-Z0-9]{0,\'.$Length.\'}/\', $string, $t);
$Output = $t . \'<br>\';
}
?>[/code] [/color]
[code]<?
$Length = 5;
$string = \'blog_post\';
if(strlen($string) > $Length){
preg_match(\'/[a-zA-Z0-9]{0,\'.$Length.\'}/\', $string, $t);
$Output = $t . \'<br>\';
}
?>[/code] [/color]
Last edited by Vercz on Tue Feb 15, 2005 11:29 am, edited 1 time in total.
Text Overflow
[url=\"http://aidan.dotgeek.org/lib/?file=function.str_chop.php\"]Also useful[/url]



