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

    I’m a new enthusiast user of ModX!
    I trying to make a website with some basic features: MaxiGallery and a self-made dropdown menu in Mootools.
    Everything is ok, but I’ve some questions about the order of the HEAD entries:
    MaxiGallery put me a mootools framework after my Chunks, also ModX put me a Mootools framework...
    Now I’ve TWO mt frameworks and it’s not good for me.
    And, at last, I put my special js functions to manage my dropdown menu in a chunk put just after stylesheet chunk in my template:

    	<title>[(site_name)] | [*pagetitle*]</title>
    	
    	{{css_structure}}
    	{{idc_customjs}}
    


    and the final result is:

    <link media="screen, projection" type="text/css" href="assets/templates/idc/css/screen.css" rel="stylesheet"></link>
    <link media="print" type="text/css" href="assets/templates/idc/css/print.css" rel="stylesheet"></link>
    <link media="screen" type="text/css" href="assets/templates/idc/css/custom.css" rel="stylesheet"></link>
    <script type="text/javascript" language="javascript">HERE THERE'S MY CUSTOM  WINDOW.ONLOAD MOOTOOLS JAVASCRIPT FOR DROPDOWN</script>
    <style type="text/css">HERE THERE'S THE CUSTOM CSS OF MAXIGALLERY</style>
    <link media="screen" type="text/css" href="/idc04/assets/snippets/maxigallery/smoothgallery/css/jd.gallery.css" rel="stylesheet"></link>
    <script src="/idc04/assets/snippets/maxigallery/smoothgallery/js/mootools.js" type="text/javascript"></script>
    <script src="/idc04/assets/snippets/maxigallery/smoothgallery/js/jd.gallery.js" type="text/javascript"></script>
    <link media="screen" type="text/css" href="/idc04/assets/snippets/maxigallery/css/default.css" rel="stylesheet"></link>
    <script src="/idc04/manager/media/script/mootools/mootools.js" type="text/javascript"></script>
    <script src="/idc04/assets/modules/quick_edit/javascript/QuickEdit.js" type="text/javascript"></script>
    <link href="/idc04/assets/modules/quick_edit/styles/toolbar.css" rel="stylesheet" type="text/css"></link>
    <script type="text/javascript">HERE THERE's THE CUSTOM WINDOW.ONLOAD JS OF QUICKEDIT</script>
    


    As you can see, there is a little bit of mess... And, obsiously, my custom js for dropdown can’t work, cause the mootools framework is called after...

    how can I reorder this mess or, a little bit easy, how can I move my custom js after the mootools line?

    Thanks a lot!
      • 22303 MODX Staff
      • 10,725 Posts
      First, you’ll want to disable QuickEdit, since it injects it’s own mootools only when logged in as a manager.

      Second, I believe MaxiGallery injects javascript as well, but I think there is an option to disable that; you’ll just have to make sure you include what it needs some other way.
        • 10293
        • 13 Posts
        Thank you Og,

        but what about my custom js? Is the right way to put it in a chunk?
        is "media/script/mootools" always injected after my js chunk?

        I want to be more clean and ordered  in this my first try of modx.

        Thanks again!
          • 7231
          • 4,205 Posts
          I recommend that you use the code from when you are not logged in as a parameter (to avoid getting the QuickEdit mootools added). All JS that is loaded by a snippet will be last (just before the </head> tag but I think that all the snippets have an option to not load the JS. If you disable the JS from the snippets then you can add them manually in the order you want.

          And yes adding them in a chunk is a good idea if you have multiple templates.
            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don&#39;t know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 10293
            • 13 Posts
            Thank you for your reply dev_cw,

            Now I give it a try!

            F.
              • 10293
              • 13 Posts
              No, I didn’t find what you said... huh sorry...
                • 7231
                • 4,205 Posts
                In the MaxiGallery call add the &disable_js_libs=`1` parameter:

                &disable_js_libs

                Used when MooTools, Prototype or Scriptaculous javascript libraries are linked in the head of the site template and you want to prevent MaxiGallery from calling them also.
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don&#39;t know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 10293
                  • 13 Posts
                  OH! shocked embarrassed sorry...
                  Thank you! smiley
                    • 7231
                    • 4,205 Posts
                    No problem, the Maxigallery wiki has a lot of parameters and it is easy to miss one. I had to do a page search to find it grin
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don&#39;t know what it is.
                      Do you, Mr. Jones? - [bob dylan]
                      • 8522
                      • 145 Posts
                      Hi Funkwarrior

                      You can use quickedit and include mootools yourself, if you delete line 232 in /assets/modules/quick_edit/output.class.inc.php . Actually it’d be nice to be able to configure this.

                      If you work with mootools 1.2.1 you can use a modified quickedit, here
                      http://modxcms.com/forums/index.php/topic,30715.0.html