We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7737
    • 10 Posts
    If you have ssh access to your machine, you can use this php script I wrote that includes everything you need to test your snippets before you paste them into modx. I wrote this test harnass after banging my head against the wall trying to get my homemade snippets to work!
    <?php
    $incPath = str_replace("\\","/",dirname(__FILE__)."/includes/"); // Mod by Raymond
    set_include_path($incPath); // this now works, above code did not?
    @set_magic_quotes_runtime(0);
    include_once "quotes_stripper.inc.php";
    if (!defined("ENT_COMPAT")) define("ENT_COMPAT", 2);
    if (!defined("ENT_NOQUOTES")) define("ENT_NOQUOTES", 0);
    if (!defined("ENT_QUOTES")) define("ENT_QUOTES", 3);
    if (!function_exists('html_entity_decode')) {
            function html_entity_decode ($string, $opt = ENT_COMPAT) {
                    $trans_tbl = get_html_translation_table (HTML_ENTITIES);
                    $trans_tbl = array_flip ($trans_tbl);
                    if ($opt & 1) {
                            $trans_tbl["&apos;"] = "'";
                    }
                    if (!($opt & 2)) {
                            unset($trans_tbl["""]);
                    }
                    return strtr ($string, $trans_tbl);
            }
    }
    include_once "config.inc.php";
    include_once("document.parser.class.inc.php");
    $modx = new DocumentParser;
    
    $_lang = array();
    include_once "lang/english.inc.php";
    
    
    //begin test code here
    ?>
    
    

      • 7737
      • 10 Posts
      oh, I suppose I should mention that you should put this in your "manager" directory.
        • 32241
        • 1,495 Posts
        So you mean all I need to do is copy the code above and paste it on the above our snippet code and run it?

        Any further helps and clarification on this will be awesome.

        Thanks grin
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 7737
          • 10 Posts
          This is meant to be a standalone php file that you stick in your /manager directory. I suppose you’ll need ssh or remote desktop to take advantage of this code. Here’s some rudimentary instructions:

          1. Paste the code into a new php file, say test.php
          2. Run it, via:
          php -f test.php


          The advantage here is you’ll be able to see any errors with your code, rather than staring at a blank output if you have been developing and testing inside the MODx manager.
          • Quote from: dogas at Mar 03, 2006, 08:52 PM
            The advantage here is you’ll be able to see any errors with your code, rather than staring at a blank output if you have been developing and testing inside the MODx manager.
            Ohhh, I hope I’ve got ssh access - this sounds really useful!

            Thanks for sharing grin
              Garry Nutting
              Senior Developer
              MODX, LLC

              Email: [email protected]
              Twitter: @garryn
              Web: modx.com
              • 32241
              • 1,495 Posts
              Cool stuff. I just know that you can debug PHP code. Hey.. am I a newbie coder here? embarrassed
              After researching some more, it seems to me that PHP is more than just a scripting language. It seems to me that we can compile PHP code in fact. Woww.. that’s so cool... I wish I have some formal education with PHP language before grin
                Wendy Novianto
                [font=Verdana]PT DJAMOER Technology Media
                [font=Verdana]Xituz Media