We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8910
    • 3 Posts
    So.. Here comes my first post on the modx forums..

    I’ve just started working with modx, and have managed to port my website to it. I understood the basics of the template system right away.
    But now I want to port all my dynamic bits and pieces written with jquery, jqueryUI, dojo and so on into modx to. This is where it all fell apart for me. Chunks, Snippets, Plugins and what not. I have literally never been so confused in my life.

    So I was wondering if anyone have come across any tutorials or guides describing how to port jQuery effects, AJAX functionality and so on into modx in a step by step manner?

    Sorry for the bad english btw. Haven’t written more than search terms in english the last couple years, so I’m a bit(a huge bit) rusty.
      • 7231
      • 4,205 Posts
      The best tip is to do it like you would in a ’normal’ site. Depending on what you want to achieve you could either simply add the JS to the template, or add it dynamically via a snippet (php code that will load the js according to some criteria), in a Template Variable (you can add a TV to the template and in the Manager define the content for that TV on each document) or a combination of methods.

      If it is something that will be present throughout the site or is somehow tied to a specific section you could add it to the template and select that template for the pages that need the JS.

      If it will be used only in specific instances yo can create a snippet to load it according to the defined criteria... for example load the JS if the document ID == xx or is a child of XX.

      You can use a Checkbox TV (or a select TV) and have a snippet load a Chunk according to the TVs selected option (see the wiki post on how to do this, remember to follow only the instructions for the Evolution version unless you are using Revolution).

      Anyway, there are many options on how to do this depending on what you want to do and how you want to manage it. Hope this helps get you started and has not made you more confused. rolleyes
        [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't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 8910
        • 3 Posts
        Thanks! I really appreciate the quick reply. Most of what you wrote confused me at first but combining with the docs and a couple of blog posts I felt a little bit enlightened. smiley

        Tried inline scripting in the template, but I couldn’t get that to work in evolution, so I downloaded Revolution and it worked perfectly. Don’t know why it did. Don’t care either actually, now I’m just jumping up and down. laugh
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          If you were working as a logged-in Manager user, it’s possible that your inline javascript was in conflict with QuickEdit. I usually disable the QuickEdit plugin while developing my javascript, then turn it on to see if it breaks, and if it does, just live without it. To be honest, I don’t much care for front-end editing anyway.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org