TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   How to detect if keyword is too long (http://www.talkphp.com/general/5527-how-detect-if-keyword-too-long.html)

CΛSTΞX 07-13-2010 08:59 PM

How to detect if keyword is too long
 
Hello, in my site's comments page, sometimes users write comments like

Hfgdgggggggggggggggggggggggggggggggggggggggggggggg gggggggggggggggggggggggggggggggggggggggggggggggggg ggggggggggggggggggg

and that crashes my template. Is there anyway to detect and remove that sh*t ?

Thanks!

CoryMathews 07-13-2010 09:25 PM

thats where the & shy ; (no spaces between) character comes into play. It will split a word if its to long. Use php to insert it into words longer then some length.

alternatively just add a css property or overflow:hidden;

CΛSTΞX 07-13-2010 10:05 PM

Thanks. Gonna try these.

adamdecaf 07-15-2010 10:48 PM

PHP Code:

wordwrap("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"15"<br />\n"); 


delayedinsanity 07-16-2010 12:02 AM

Realllly? Somebody spent the time to make wordwrap() a core function in PHP?

Enfernikus 07-16-2010 02:31 AM

It's from one of the early versions of PHP4, PHP3 was still being maintained when wordwrap was introduced if memory serves.

Back then the language was for little more than adding stat counters (hyperbole of course)


All times are GMT. The time now is 03:53 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0