We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32982
    • 674 Posts
    at the end could install the php eclipse plugin (not the css) i need to launch another instance of eclipse refreshing workspace, is a very good tool for programmers but im not it
    thanks
      Jabiertxof (formerly XYZVISUAL)
      My bussines: http://marker.es
      https://www.youtube.com/user/jabiertxof/videos
      • 34162
      • 1 Posts
      Excellent idea to jump into a 9month old thread, isn’t it? laugh
      But it’s not my fault that it took until today: My first attempt to use Eclipse to work with MODx (i.e. writing/debugging snippets/modules etc.)
      Maybe one of the coders using that tool for their MODx-development can help me on how to configure the debugger correctly. I’m on a Mac, using the MAMP-package.
      How could I debug a module’s code for instance?
      All these functions are usually triggered by $_POST events or directly from within the manager. But, in Eclipse of course I have no manager. :’(
      Must I just play around in the MODx manager, running Eclipse in the background - just hoping that the debugger will properly intercept and point me to the error if something goes wrong? No idea, really. Yes, I’m a newbie, never tried this kind of "re-engineering" approach, just played around with my own little pieces of code...
        • 10487 MODX Staff
        • 1,535 Posts
        How could I debug a module’s code for instance?
        Well, there is the DBG debugger built into Eclipse but I have to say that I haven’t used it (perhaps somebody else might be able to help on that one).

        The way that I generally do things is to output key variables using print and print_r so I can see the values that are being passed around in the script. Simple things like:
        print_r($_POST);


        (You can add comment flags to these lines, eg. //TODO: debug point, remove for release version, and you can easily set custom flags in the preferences as well - this makes keeping track of what debug points have been added and where an absolute breeze)

        The code checking that phpEclipse does is good at pointing out missing braces and such like, so generally it’s just checking that the logic is as intended. The MODx parse errors and run-time errors will generally give a line number where it has failed, so it’s just a case of tracing errors back from that point.

        Hope that helps,
        Garry
          Garry Nutting
          Senior Developer
          MODX, LLC

          Email: [email protected]
          Twitter: @garryn
          Web: modx.com
          • 34162
          • 1 Posts
          Yes, that helps. It’s not the way I would expect a debugger to work in my own projects, but this is due to MODx being a web-application, I guess these are generally harder to debug than local ones, esp. when "re-engineering". Got to dive deeper into that stuff, but for now I’m fine.
          Thanks again, Garry!

          ppaul
            • 22303 MODX Staff
            • 10,725 Posts
            Just a couple of notes here...

            First, remote debugging of web applications like MODx is possible with PHPEclipse and DBG. I use it quite a bit actually. To get your remote debugging environment working, or just to learn more about using PHPEclipse in general, I suggest reading the information here:

            http://www.plog4u.org/index.php/Using_PHPEclipse

            I use this reference all the time, and have, like I said, successfully used DBG to debug core MODx code (and even to profile requests) following the instructions there.

            However, you will not be able to step through the execution of plugins or snippets at all. This is due to the fact that MODx uses eval() to execute this code. This is one of the reasons I chose to get rid of the eval()’s (in addition to security and performance concerns) in the new MODx 1.0 core, which will allow developers to easily step through any MODx request, including all of the plugins, snippets, etc. using any popular IDE/debugger.