We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6635
    • 4 Posts
    I’ve been delegated the task of determining if ModX can run a javascript package we deliver to various websites. I’ve experience with various CMS’s and find ModX most promising.

    Test demos;
    http://test.rbma.com/demos/ck-test.php
    http://test.rbma.com/demos/ck-test-2.php

    The first version is handled with a wrapper snippet. This seems to work well until one attempts to use the Favorites selections. Clicking OK from the favorites panel reloads the entire site in the iframe (bad thing).

    Second attempt places the javascript directly into Resource Content. The exception to this working properly is that when selecting a comic the URL drops the "current" page URL.

    The javascript attempts to append to the current URL. For some reason the javascript is not picking up the current URL. It’s picking-up the site root URL and appending to that. Result is redirect to the home page.

    I’m open for any ideas the community may have to overcome the issue and assist in getting this javascript to function within the ModX framework.


    Thanks!
    Rick
      • 4310
      • 2,310 Posts
      For method two you’ll need to fix any null/anchor <a href> tags going to the site start with one of the available plug-ins.
      E.G. Base URL Same-Page-Link Fix.
        • 6635
        • 4 Posts
        Quote from: bunk58 at Dec 02, 2009, 04:04 AM

        For method two you’ll need to fix any null/anchor <a href> tags going to the site start with one of the available plug-ins.
        E.G. Base URL Same-Page-Link Fix.

        Attempted this with no change in behavior. Thanks for the suggestion. Any others?
          • 4310
          • 2,310 Posts
          I didn’t realise it was all being loaded remotely via their JS file.
          When I add their url to yours it works so maybe try this plug-in code instead of the one I linked to.
          Untested!
          $source = &$modx->documentOutput;
          $doubleQuote = 'href="?';
          $source = str_replace($doubleQuote, 'href="'.$_SERVER["REQUEST_URI"].'?', $source);
          
            • 6635
            • 4 Posts
            Quote from: bunk58 at Dec 02, 2009, 12:00 PM

            I didn’t realise it was all being loaded remotely via their JS file.
            When I add their url to yours it works so maybe try this plug-in code instead of the one I linked to.
            Untested!
            $source = &$modx->documentOutput;
            $doubleQuote = 'href="?';
            $source = str_replace($doubleQuote, 'href="'.$_SERVER["REQUEST_URI"].'?', $source);
            


            I replaced the code in the plugin you linked to earlier rather than create a new plugin. Hopefully that was the plan or will suffice. Unfortunately, doing so didn’t change the behavior.

            Of course, I didn’t change anything else in the plugin parameters. Is there a system event that needs to be checked to activate the code?

            Thanks for the input and assistance David! I really don’t want to tell ModX users it "can’t be done".
              • 4310
              • 2,310 Posts
              OnWebPagePrerender as in the original.
                • 6635
                • 4 Posts
                Quote from: bunk58 at Dec 02, 2009, 12:20 PM

                OnWebPagePrerender as in the original.

                That’s the way I left it.