Preventing Long Text

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Preventing Long Text

    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..

    #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.

    Comment


      #3
      PHP Code:
      .text{
      width160px;
      }

      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...
      _______
      Info & Tips
      php.net
      w3schools.com

      Comment


        #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...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #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..

          Comment


            #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...
            _______
            Info & Tips
            php.net
            w3schools.com

            Comment


              #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?

              Comment


                #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...
                _______
                Info & Tips
                php.net
                w3schools.com

                Comment


                  #9
                  if (strlen($text>160)){@mysql_query(update.....)}else {
                  }
                  this is it
                  Last edited by khan; 29.04.10, 08:23.

                  Comment


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

                    gmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgmgm gm

                    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..

                    Comment


                      #11
                      use CSS to hide the overflow text!

                      ex:
                      body{
                      overflow:hidden;}


                      ---------
                      LoL!

                      Comment


                        #12
                        Heres An AntiFlood Function Iv Just Made:
                        PHP Code:
                        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:
                        PHP Code:
                        $text=antiflood($text); 
                        Hope It Helps

                        (Its Limited To 20 Letters Per Word ATM)
                        Last edited by something else; 09.05.10, 15:26. Reason: update

                        Comment


                          #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

                          Comment

                          Working...
                          X