We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40313
    • 8 Posts
    I am trying to run a short javascript inside a modx page. It seems to work fine outside of modx: http://daviddoria.com/Uploads/moderator.html - but inside modx, http://pointclouds.org/ideas.html it doesn't get displayed? Comparing the source they are they same (modulo the page styling)... i.e. it seems as though what'd i'm doing in modx is generating the correct html? Does anyone know what might be going wrong?

    Thanks,

    David
      • 36734
      • 14 Posts
      MODx is pretty much agnostic on the language generated (xml, html, js, whatever you can imagine).

      In your case, I think the problem comes from the div in the second version :
      <div id=”moderator-embed-target”></div>

      if you look carefully, the quotes are not correct (should be ", not ”). Does it work ?
        • 40313
        • 8 Posts
        The problem was the kind of quotes that were used, thanks eprochasson!

        In the "div id" line, the quotes used around "moderator-embed-target" were not "normal" quotes, but rather something more like `` (perhaps caused by pasting into the non-plain text, or copying from a strange source?).

        Thanks for the fix! [ed. note: daviddoria last edited this post 14 years, 3 months ago.]
          • 32316
          • 387 Posts
          eprochasson wrote:

          inquiring minds want to know what he wrote!!
            • 40313
            • 8 Posts
            I think he has a <div> tag in the post (I did that too, and it made my original post blank).
              • 32316
              • 387 Posts
              if I click the quote in the "post right tool menu thingie" it quotes eprochasson as having said:
              Quote from: eprochasson at Jul 03, 2012, 06:00 AM
              MODx is pretty much agnostic on the language generated (xml, html, js, whatever you can imagine).

              In your case, I think the problem comes from the div in the second version :
              <div id=”moderator-embed-target”></div>


              if you look carefully, the quotes are not correct (should be ", not ” ). Does it work ?

              I added code tags around the div so that they might display. It (the forum code tags) do not know what to do with the curly quotes ( ” ) so the code is not exactly what was entered... oh well...
                • 3749
                • 24,544 Posts
                Curly quotes will definitely mess things up in the Forums and in MODX in general. They usually mean someone pasted from MS Word, but who writes code in Word? wink


                ------------------------------------------------------------------------------------------
                PLEASE, PLEASE specify the version of MODX you are using.
                MODX info for everyone: http://bobsguides.com/modx.html
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 32316
                  • 387 Posts
                  but who writes code in Word?
                  not me - I manage to avoid it completely!!

                  I tried substituting "&_rdquo;" for ” (except with no _ between the & and the r) and &_ldquo; for “ to display what was apparently written but that comes out like this:
                  “there should be curly double quotes around this text”

                  should look like this:
                  “there should be curly double quotes around this text”

                  too much like hard work and too little time

                  oh and I did not really want to edit what was written [ed. note: whistlemaker last edited this post 14 years, 3 months ago.]
                    • 3749
                    • 24,544 Posts
                    I found out that WordPress has a filter that turns regular quotes into curly quotes for you, so text pasted from WP could be a problem.

                    In the old days, you could get rid of curly quotes by pasting stuff into Notepad and then pasting it back. I just tried it and it no longer works. I guess Notepad has gotten smarter.

                    After I made my post above, I thought of the irony of me saying, "who writes code in Word." I do. I wrote a ton of it for my book. I have a macro in Word (ctrl-q) that toggles the curly quotes feature.



                    ------------------------------------------------------------------------------------------
                    PLEASE, PLEASE specify the version of MODX you are using.
                    MODX info for everyone: http://bobsguides.com/modx.html
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting