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

    I’ve recently started developing with MODx and am curious as to where to turn on debugging information. I see that there is an old debugTool but is seems obsolete. Is there a debug pop-up/console or reporting other than the events log that can be turned on during development?

    For instance if I use print_r($modx) within a snippet to see the what’s stored etc. it often crashes the web server. !

    Are there other debugging methods/tips within MODx that others could share?

    Cheers,
    Ryan
      • 21279
      • 13 Posts
      Found this .. hope it helps someone:

      <?php
      die(print_r($modx,true));
      ?>
        • 18397
        • 3,250 Posts
        This should also work as a snippet:

        <?php
        return var_export($modx,true);
        ?>
        
          • 22303 MODX Staff
          • 10,725 Posts
          Just a hint: I would suggest starting out by printing more specific information, i.e. print_r($modx->placeholders), etc., so you don’t get inundated with unnecessary information. The modx object just holds a large amount of data, so debugging is more efficient if you target specific pieces of data from it that you are working with. If you don’t know what you’re looking for, or are just curious about the data, then printing out the whole object is obviously helpful, so you can search through the output to find what you need or just peek at the state of various data elements moving through the system.