The problem is that only "Cannot format code with syntax errors" is displayed as a pop-up (HTML & PHP mixed) when I try to format the complete code. There is no indication of a problem with the code, only this error message when the code is to be formatted. Unfortunately, there is also no indication of the line number, so that this could be checked.

Of course, a quick fix for the problem would be great, but in order to work with it at all without having to go through it line by line, the indication of the line number with this message would already be very helpful.

Most of the time, one of the triggers is the following code, which was formatted using PHP Devsense (of course according to my settings):

<a class="btn btn-danger mr-2 mr-md-4" href="index.php?page=users-delete&submenu=<?php echo $_GET['submenu']; ?>&id=<?php echo $Users['user_id'];
                               echo (isset($langlink) and $langlink) ? '&'.$langlink : NULL;
                               echo (isset($admin_site) and $admin_site) ? '&'.$admin_site : NULL; ?>"
                                role="button"><?php echo translate_text('Löschen') ?></a>

    So when I open the document (before), the problem with formatting already starts with the line:

    <a class="btn btn-outline-cms-gray" href="index.php?page=communication-systems&submenu=<?php echo $_GET['submenu']; echo (isset($langlink) AND $langlink) ? '&'.$langlink : NULL; echo (isset($admin_site) AND $admin_site) ? '&'.$admin_site : NULL; ?>" role="button"><?php echo translate_text('Zurück') ?></a>

    But after I have formatted the content of the "href" by selection, the code looks like this:

    <a class="btn btn-outline-cms-gray" href="index.php?page=communication-systems&submenu=<?php echo $_GET['submenu'];
                                            echo (isset($langlink) and $langlink) ? '&'.$langlink : NULL;
                                            echo (isset($admin_site) and $admin_site) ? '&'.$admin_site : NULL; ?>" role="button"><?php echo translate_text('Zurück') ?></a>

    If this is the only issue, the document can be successfully formatted afterwards and looks like this:

    <a class="btn btn-outline-cms-gray" href="index.php?page=communication-systems&submenu=<?php echo $_GET['submenu'];
                             echo (isset($langlink) and $langlink) ? '&'.$langlink : NULL;
                             echo (isset($admin_site) and $admin_site) ? '&'.$admin_site : NULL; ?>
    " role="button"> <?php echo translate_text('Zurück') ?></a>

    Perhaps it would make sense to put PHP first and HTML/REST second.

      Hello,

      Thank you for reporting this.

      1.) Cannot format code with syntax errors, makes perfect sense. We will do it
      2.) The snippet you've provided... it's actually a very rare bug, but thanks to you I've been able to locate it :-) Will be fixed in the pre-release

      Thank you!

      • DP24 replied to this.

        Hello,

        May I ask you to try out the latest pre-release? There is a handling of 2 case there.

        Thank you

        MiloslavBeno

        Regarding point 1, I completely agree. Once a syntax error has been detected, it would be beneficial to directly display the line number where the error occurred, similar to how other messages are displayed. This would make it easier to locate the problem.

        As for point 2, I'm glad I could help. I also have a similar case involving a connection issue in JavaScript code.

        <script type="application/javascript">
        window.location.href = "index.php?page=shop-sales&submenu=shops_submenu&ShopID=<?php echo $user['shop_id'];
        echo (isset($langlink) and $langlink) ? '&'.$langlink : NULL;
        echo (isset($admin_site) and $admin_site) ? '&'.$admin_site : NULL; ?>";
        </script>


        MiloslavBeno

        Tested and the previous error has been fixed, thank you very much ;)

          Great! I'll close this one then.

          About 1.) we will add it soon.

          Thank you

          Write a Reply...