We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 727
    • 502 Posts
    I am using MODx 1.0 to build a site that will use Javascript (Dojo) to create a so-called Rich Internet Application.

    This application will be fairly complex and I will need a source code editor and debugging features.

    I know how to do this for local files using Eclipse and Aptana Studio, and that solution is perfect. But are there any suggestions on how I can do this while using MODx for the site framework?

    Once the site is public I also need these features to be able to support it.

    My only thoughts right now is to put as much JS code as possible into separate files and work with those, then use Firebug for debugging (if that’s even possible). But are there any better ways of doing it? Preferably without expensive software.

    thanks, Andy
      • 17499 ☆ A M B ☆
      • 872 Posts
      My only thoughts right now is to put as much JS code as possible into separate files and work with those, then use Firebug for debugging (if that’s even possible). But are there any better ways of doing it? Preferably without expensive software.

      That’s one the way, and by far the one i like the most and use on daily basis.

      Actually, i’m using extjs, jquery and jqueryui on several parts of a website and just include the js code via the regstartupscript() and regstartuphtml() functions of modx and then do all the debugging with firebug without any problem.

      Using the database chunk based is up to you, i do prefer to put my js on an external files, so i can modify quickly locally with my favorite editor and just refresh my page when needed.
        • 727
        • 502 Posts
        Thanks. I’ve searched and can’t find any information on regStartupScript except a couple of forum references. Can you please post a quick example? Where/how is the function called?

        thanks, Andy
          • 17499 ☆ A M B ☆
          • 872 Posts
          Sure,

          here is how you can use it:

          <?php
          
          global $modx;
          
          //Will load an external file in the header
          $src = "assets/js/jquery/jquery.customInput.js";
          $modx->regClientStartupScript($src);
          
          //Will load an html element in the header
          $inlineScript = 
          		'<script type="text/javascript">
          			$(document).ready(function(){
          				[ your code ]
          			});
          		</script>';	
          $modx->regClientStartupHTMLBlock($inlineScript);
          
            • 727
            • 502 Posts
            Thanks!

            Andy