Preventing Long Text

Started on the old forum in April 2010 · view the original in the archive · old links redirect here

12 replies · 793 views · started 16 years ago · 1 min read

6 participants
l0rdrayven Developer · 83 posts #1

Guys can anyone share the code on how to prevent the long text messages without spaces such as like this one.

Gmgmgmgmgmgmgmgmgmgmgmgmgm

It destroy my site fit to browser screen cause it causes scoll to left functions of mobile browsers. I just want to put a limit then space down automatically will take the rest. I dont know if i explain it will. I think it can be done in css body style but i dont know what is the code, in php script i think it was started with if(strlen etc,etc.., Thanks for the help..

Not i rip persons off i will also do your arse !

l0rdrayven Developer · 83 posts #2

Its not the function to substract the text, linebreak will take the action to move the next text in the next line instead of letting the text or message go further to the left.. Hope that you will comprehend what i mean.

Not i rip persons off i will also do your arse !

subzero Super moderator Fellow · 3,954 posts #3
.text{
width: 160px;
}

echo "<div id=\"text\">";
echo $text;
echo "</div>";

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

subzero Super moderator Fellow · 3,954 posts #4

.text{ width: 160px; }

to

#text{ width: 160px; }

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

l0rdrayven Developer · 83 posts #5

Thanks bro i tried it in my css .text{width: 160px;} but it is not working, long text without spaces keeps go further to the left side of my site..

Not i rip persons off i will also do your arse !

subzero Super moderator Fellow · 3,954 posts #6

you will need to change it bro ...

.test to #text

i made a error not you

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

l0rdrayven Developer · 83 posts #7

Ok bro i will try it.. But how about in php code.. If im not mistaken it was something like this...

$text = if(strlen($text>20))&& etc, etc,

I dont know whats next but im sure that code was type befor the text declare... echo "$text"; but much better if we were goin to make it in css for overall function isnt it?

Not i rip persons off i will also do your arse !

subzero Super moderator Fellow · 3,954 posts #8

it will change to

awshfjasifksdjfk jkwdfjkasjckmj wefjaqjdwkwaesqjdfkj jaskrjkwkwdejksda fcawesjfrksaejfkejwfkj kjrkjwekjwefkj

to

awshfjasifksdjfk jkwdfjkasjckmj wefjaqjdwkwaesqjdfkj jaskrjkw fcawesjfrksaejfkejwfkj kjrkjwekj

it will keep the text on the size you want it to be...

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

l0rdrayven Developer · 83 posts #10

It is still not working in css bro subzero.. For instance i will post something like this

gmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgm

text without spaces, in my site it will go further to the left that cause the page scroll to the left functions..

I just want to prevent it or put a maximum characters per line and the rest will be posted to the next line itself..

Not i rip persons off i will also do your arse !

cpg12 Junior · 32 posts #11

use CSS to hide the overflow text!

ex: body{ overflow:hidden;}


LoL!

something else Fellow · 2,296 posts #12

Heres An AntiFlood Function Iv Just Made:

function antiflood($text){
$text=str_replace("%20"," ",$text);
$words=explode(" ",$text);
for($i=0;$i<count($words); $i++){
if(strlen($words[$i])>20){
return "AntiFlood Protection";
}
}
return $text;
}

Usage:

$text=antiflood($text);

Hope It Helps 🙂

(Its Limited To 20 Letters Per Word ATM)

jefweewap Junior · 31 posts #13

try to add this in your core.. bbcode

$text = preg_replace('{( ?.)\1{4,}}','$1$1$1',$text); //result: aaabbcccaaad d d ddde

To prevent any repetitions of characters, you only need this

$text = preg_replace('{(.)\1+}','$1',$text); //Result: abcad d d d d d d de

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close