We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13352
    • 26 Posts
    Hi,

    I tried to create a module. I use Susan’s tutorial as reference: http://www.sottwell.com/create-module.html

    I just create : echo "Aloha"; for the module code. Using ’Test’ as module name.
    Then I can see the submenu ’Test’ under Module. As I click at it, it just empty.

    I got this error at apache log file :

    PHP Parser error: syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING in /home/myname/www/manager/processors/execute_module.processor.php(114) : eval()’d code on line 1, referer: http://www.mydomain.com/manager/index.php?a=1&f=menu

    I saw in Mysql, it addslash to echo => echo \"Aloha\";

    What is the problem ? Any information will be welcome smiley

    Thanks in advanced.
    - jack -
      • 13352
      • 26 Posts
      Quote from: jackprobe at May 07, 2010, 05:46 AM

      Hi,

      I tried to create a module. I use Susan’s tutorial as reference: http://www.sottwell.com/create-module.html

      I just create : echo "Aloha"; for the module code. Using ’Test’ as module name.
      Then I can see the submenu ’Test’ under Module. As I click at it, it just empty.

      I got this error at apache log file :

      PHP Parser error: syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING in /home/myname/www/manager/processors/execute_module.processor.php(114) : eval()’d code on line 1, referer: http://www.mydomain.com/manager/index.php?a=1&f=menu

      I saw in Mysql, it addslash to echo => echo \"Aloha\";

      What is the problem ? Any information will be welcome smiley

      Thanks in advanced.
      - jack -



      Hi,

      Every time I edit that module via Module management, it add a new backslash ’\’ to database.
      So, from the module manager => echo "Aloha ";
      In database, it became :
      echo \"Aloha \";
      

      Now, it becomes :
      echo \\\\"Aloha \\\\";
      



      Then I update the database (from mysql shell prompt) to remove the backslash (\) :

      mysql> update modx_site_modules set modulecode='echo "Just testing , my new module"; ' where id=22;
      


      Now it works. But why Module management add a backslash ? How to remove this backslash via Module management ?

      Thanks.
      - jack -

        • 11055 ☆ A M B ☆
        • 3,112 Posts
        it means it doubles the addslashes.
        just debug the module code, use echo stripslashes($modulecode); when it calls out.
          Rico
          Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
          MODx is great, but knowing how to use it well makes it perfect!

          www.virtudraft.com

          Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

          Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

          Maintainter/contributor of Babel

          Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Sounds like you have "magic_quotes_gpc" turned on in your php.ini
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 13352
            • 26 Posts
            Quote from: sottwell at May 07, 2010, 08:42 AM

            Sounds like you have "magic_quotes_gpc" turned on in your php.ini

            Hi Goldsky,
            I thinks Sottwell is right. I think it’s something like this : http://modxcms.com/forums/index.php/topic,49030.0.html

            Hi Susan,

            Yes, you’re right. It was ON, I turned it to OFF, restart Apache, but still didn’t work.
            One question : Setting it to OFF will not descrease the security ?

            Solution:
            I just update the field via mysql shell prompt, REMOVE the backslash, and it works.

            But I must do this, every time I create a new module ... sad

            I’m using LAMP server kernel 2.6.x, apache 2.2.x, Mysql 6.x, PHP 5.3.x
            Modx 1.0.3

            Many thanks Susan, you’re so great.
            - jack -
              • 13352
              • 26 Posts
              Quote from: jackprobe at May 08, 2010, 02:59 AM

              Quote from: sottwell at May 07, 2010, 08:42 AM

              Sounds like you have "magic_quotes_gpc" turned on in your php.ini

              Hi Goldsky,
              I thinks Sottwell is right. I think it’s something like this : http://modxcms.com/forums/index.php/topic,49030.0.html

              Hi Susan,

              Yes, you’re right. It was ON, I turned it to OFF, restart Apache, but still didn’t work.
              One question : Setting it to OFF will not descrease the security ?

              Solution:
              I just update the field via mysql shell prompt, REMOVE the backslash, and it works.

              But I must do this, every time I create a new module ... sad

              I’m using LAMP server kernel 2.6.x, apache 2.2.x, Mysql 6.x, PHP 5.3.x
              Modx 1.0.3

              Many thanks Susan, you’re so great.
              - jack -




              Hi Susan,

              I’m so confused ... sad ... After I restart mycomputer, go to manager area, clear cache, restart Apache again, create a new php.ini file under www/ & www/manager -> setting: register_globals OFF, magic_quotes_gpc OFF (the same as main server php.ini file).
              Now it works. Great ... smiley

              Many thanks again.
              - jack -
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Sometimes that’s what it takes. It all depends on server configuration, and where the actual master php.ini file your installation is using resides.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org