Announcement

Collapse
No announcement yet.

PHP BBCode tag brakes line break

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

  • PHP BBCode tag brakes line break

    As the title describes, when I add the [PHP] BBCode tags, all my line breaks get broken, so if I have the following code:

    $var = 'hello';
    $var2 = 'hello2';

    After I publish the post I will have:

    $var = 'hello';$var2 = 'hello2';

    Why is vBulletin doing this??? To fix it I have to edit the post and edit it using the enter or space bar keys to put again the spaces. The same happens when you tabulations. Ex.:

    if (true) {
    $code = 'test';
    }

    Result:

    if (true) { $code = 'test';}


    How can I solve this? It's really annoying when you have big blocks of code. I hope you can understand what my problem is.

    Thanks.



  • #2
    Anyone can help with this?

    Comment


    • #3
      It depends where you are copying the code from.

      php tags are not designed to respect html formatting and will strip them out, so if you're copying code from a web page you may find that's what's happening.

      If you use a proper code editor such as Notepad++ and copy code from there, it will work.
      MARK.B | vBULLETIN SUPPORT

      TalkNewsUK - My vBulletin 5.6.4 Demo
      AdminAmmo - My Cloud Demo

      Comment


      • #4
        What version are you using ?
        Baby, I was born this way

        Comment


        • #5
          Originally posted by Mark.B View Post
          It depends where you are copying the code from.

          php tags are not designed to respect html formatting and will strip them out, so if you're copying code from a web page you may find that's what's happening.

          If you use a proper code editor such as Notepad++ and copy code from there, it will work.
          I always copy the code from my PHP Editor, such as NetBeans, but fails anyway, no matter where is being copy from.

          Originally posted by Paul M View Post
          What version are you using ?

          I'm using the latest vBulletin 4 version. 4.2.3
          Last edited by lucky89; Thu 18 Feb '16, 8:58am.

          Comment


          • #6
            Again... anyone please???

            Comment


            • #7
              I'm still needing help with this!!!!! PLEASEEEE! I have payed for vBulletin, you must give me a solution for this!

              Comment


              • #8
                Working fine on my 4.2.3 test site copying the code directly from the post above!
                Click image for larger version

Name:	
Views:	159
Size:	379.1 KB
ID:	4340026

                To troubleshoot this, first download a fresh copy of the vBulletin ZIP file from the Members Area then reupload all the original vB non-image files (except install.php). Make sure you upload these in ASCII format and overwrite the ones on the server. Also be sure to upload the admincp files to whichever directory you have set in your config.php file. Then run 'Suspect File Versions' in Diagnostics to make sure you have all the original files for your version and that none show 'File does not contain expected contents':

                Admin CP -> Maintenance -> Diagnostics -> Suspect File Versions

                [Note: In some cases you may also need to remove any of the listed .xml files in the includes/xml directory.]

                Next, disable all plugins. Note: To temporarily disable the plugin system, edit config.php and add this line right under <?php:

                define('DISABLE_HOOKS', true);

                Then if you still have this problem, create a new style and choose no parent style. This will force it to use the default templates. Finally empty your browser cache, close all browser windows then try again. Make sure you change to the new style and view your forums with it.

                Do you have the same problem?
                Vote for:

                - *Admin Settable Paid Subscription Reminder Timeframe*
                -
                *PM - Add ability to reply to originator only*
                - Add Admin ability to auto-subscribe users to specific channel(s)
                - "Quick Route" Interface...

                Comment


                • #9
                  Originally posted by lucky89 View Post
                  I'm still needing help with this!!!!! PLEASEEEE! I have payed for vBulletin, you must give me a solution for this!
                  The fact you paid for it doesnt not somehow mean the universe has magic answers. If someone knew the answer, they would post it.

                  Baby, I was born this way

                  Comment


                  • #10
                    Originally posted by Trevor Hannant View Post
                    Working fine on my 4.2.3 test site copying the code directly from the post above!
                    [ATTACH=CONFIG]n4340026[/ATTACH]
                    To troubleshoot this, first download a fresh copy of the vBulletin ZIP file from the Members Area then reupload all the original vB non-image files (except install.php). Make sure you upload these in ASCII format and overwrite the ones on the server. Also be sure to upload the admincp files to whichever directory you have set in your config.php file. Then run 'Suspect File Versions' in Diagnostics to make sure you have all the original files for your version and that none show 'File does not contain expected contents':

                    Admin CP -> Maintenance -> Diagnostics -> Suspect File Versions

                    [Note: In some cases you may also need to remove any of the listed .xml files in the includes/xml directory.]

                    Next, disable all plugins. Note: To temporarily disable the plugin system, edit config.php and add this line right under <?php:

                    define('DISABLE_HOOKS', true);

                    Then if you still have this problem, create a new style and choose no parent style. This will force it to use the default templates. Finally empty your browser cache, close all browser windows then try again. Make sure you change to the new style and view your forums with it.

                    Do you have the same problem?

                    I did a fresh install... for me it is not working. Here is an image, as you can see the code looks really bad, it is impossible to read or follow, the code was copy and paste from:
                    TextWrangler, I have also tried NetBeans and using LF line endings. The code gets messed up.

                    Originally posted by Paul M View Post
                    The fact you paid for it doesnt not somehow mean the universe has magic answers. If someone knew the answer, they would post it.
                    I'm not asking for magic answers, I'm asking for a fix introduced clearly by a product that you sell, the image is the proof, and even more, It worked perfectly until you changed the vBulletin editor on the 4.x.x versions.
                    Last edited by lucky89; Wed 23 Mar '16, 12:09pm.

                    Comment


                    • #11
                      The problem is that it's not broken on any of our own installations. This suggests there's something related to your server setup that is causing this.
                      MARK.B | vBULLETIN SUPPORT

                      TalkNewsUK - My vBulletin 5.6.4 Demo
                      AdminAmmo - My Cloud Demo

                      Comment


                      • #12
                        I have installed this on my localhost, I have also made a try in my hosting, and it is the same problem. I can't debug this issue, vBulletin is huge it can take me hours or days, you are the experts here. I'm pretty sure that if you look the code a little you will get there.

                        Edit:
                        Ok, I have tried the following...

                        - Mac CR w/ utf-8 and without
                        - Unix LF w/ utf-8 and without
                        - Windows CRLF w/ utf-8 and without

                        Copying and pasting doesn't work at all, but... I made it work doing the following:

                        1º Copy the code.-
                        2º Paste the code in the post without the [PHP] tags.-
                        3º Save the post.-
                        4º Edit the post.-
                        5º Cut the code from the post.-
                        6º Put the [PHP] tags.-
                        7º Paste inside the [PHP] tags the code that I just cut from the post.-
                        8º Save the post.-
                        9º The code was perfectly formatted, see the attachment.-

                        Clearly, there is a difference in the parsing when vBulletin uses the PHP tags and when it does not, PLEASE look at this issue.-
                        Attached Files
                        Last edited by lucky89; Thu 24 Mar '16, 7:02am.

                        Comment


                        • #13
                          Why do I have to beg for a solution??? The error is clearly related to vBulletin.

                          Comment


                          • #14
                            Originally posted by lucky89 View Post
                            Why do I have to beg for a solution??? The error is clearly related to vBulletin.
                            No it isn't, as has been pointed out, several of us are unable to replicate the issue on our own installations. There isn't a solution, because nobody can replicate this on any of the vB4 setups we have.

                            This is something related to your own set up. I would suggest disabling hooks and creating a new style:

                            Please try the following:

                            1. To disable the plugin/hook system completely, edit includes/config.php and add the following code:
                            Just below
                            Code:
                            <?php
                            enter
                            Code:
                            define('DISABLE_HOOKS', true);
                            2. Now go to AdminCP > Style Manager
                            and create a new style with no parent.
                            Now browse your forum using this new style.
                            MARK.B | vBULLETIN SUPPORT

                            TalkNewsUK - My vBulletin 5.6.4 Demo
                            AdminAmmo - My Cloud Demo

                            Comment


                            • #15
                              Originally posted by lucky89 View Post
                              Why do I have to beg for a solution??? The error is clearly related to vBulletin.
                              I can't reproduce this error on a fresh installation of vB4.2.3 following your instructions in post #12. So, it isn't just vB Staff deciding not to help you.

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X