We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27106
    • 147 Posts
    I have a piece of MODX code doing something I didn't think was possible: being served up in Chrome but not in Firefox/IE/Safari. It's a simple getResources call designed to rotate the contents of four different resources into the page, so that you get a different image each time you visit:

    The getResources call:
    [[!getResources? &parents=`187` &tpl=`listContentBare` &sortdir=`ASC` &limit=`1` &sortby=`RAND()` &includeContent=`1`]]

    The listContentBare tpl:
    [[+content]]

    The content for one of the resources under the 187 parent:
    <img id="front-champ-pic" class="champion" src="/assets/images/display/pic_1.jpg" alt="Some text here" />


    In Chrome the code is working to rotate the images randomly. In other browsers nothing at all shows between the two DIV tags where the getResources call is placed.

    The page is cacheable. The problem persists whether the getResources call is made cached or uncached.

    I originally thought this was a server or browser caching issue, but new material I add to the page outside the getResources call shows up instantly in all browsers.

    My biggest clue is that the code is not served up in Chrome in incognito mode. I have no idea what that could imply, but I hope someone else might. I would take it as another sign of a caching issue - but like I said, when I make other changes to the page, they show up fine.

    Darndest thing I ever saw ...

    This question has been answered by Bruno17. See the first response.

      David Walker
      Principal, Shorewalker DMS
      Phone: 03 8899 7790
      Mobile: 0407 133 020
      • 27106
      • 147 Posts
      Quote from: shorewalker at Mar 12, 2014, 10:51 PM
      I have a piece of MODX code doing something I didn't think was possible: being served up in Chrome but not in Firefox/IE/Safari ... My biggest clue is that the code is not served up in Chrome in incognito mode. I have no idea what that could imply, but I hope someone else might. I would take it as another sign of a caching issue - but like I said, when I make other changes to the page, they show up fine.


      And of course a few minutes thought shows it can only be a manager issue. The images show up when I'm logged in, and not when I'm not. Because something, somewhere is unpublished.

      Hold on while I run a few checks ...
        David Walker
        Principal, Shorewalker DMS
        Phone: 03 8899 7790
        Mobile: 0407 133 020
        • 14951
        • 151 Posts
        Wow, definitely a strange one! Is there any javascript involved at this point? My initial troubleshooting steps are always to shut off CSS and Javascript so that I have nothing but html. Have you given this a try?

        I'm not entirely familiar with the mechanics of Incognito Mode in chrome but if I remember correctly, cookies aren't saved, data isn't cached, history isn't stored, and sessions are reset on each page refresh. This would lead me to believe that you might be seeing a local cache in Chrome when not in Incognito mode.

        Funny thing is... half the time I run into stuff like this... I'm editing the wrong website or editing a live version and previewing my local copy of something silly like that.

        Do you have a link for anyone else to take a peek?
          • 14951
          • 151 Posts
          Quote from: shorewalker at Mar 12, 2014, 11:16 PM
          And of course a few minutes thought shows it can only be a manager issue.

          Forgot about that one smiley

          Of course with GetResources a quick test for unpublished would be to add the &showUnpublished param.

          I wasn't aware that GR served unpublished resources without that param... Learn something new everyday!
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Generally speaking Administrator users can see unpublished resources. I don't know if getResources will list them for the Admin user though. Wayfinder doesn't.
              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
              • 27106
              • 147 Posts
              Update. Yep, it's the manager. And as soon as I figured that out, I was willing to bet that the showUnpublished and ShowHidden parameters would fix the problem. But so far, no. Are there any other gotchas with getResources that I don't know about?
                David Walker
                Principal, Shorewalker DMS
                Phone: 03 8899 7790
                Mobile: 0407 133 020
              • discuss.answer
                • 4172
                • 5,888 Posts
                some points to check:
                Resource unpublished?
                Resource in a Resource - group?
                parent in a Resource - group? - not sure, if this could matter.

                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 27106
                  • 147 Posts
                  OK, we have a winner - Bruno17. (In my very weak defence, I'd worked this out and tested it before I saw his post.)

                  It turns out that the parent of the resource you're calling with your getResources call must not be in a manager-only resource group, or getResources won't treat it as existing for the purposes of the getResources call. Makes sense.

                  In other words, Bruno's third point was right on the money. "Not sure if this could matter"? We are now - it does.

                  The MODX Forums triumph again.
                    David Walker
                    Principal, Shorewalker DMS
                    Phone: 03 8899 7790
                    Mobile: 0407 133 020
                    • 27106
                    • 147 Posts
                    Quote from: jaredloman at Mar 12, 2014, 11:19 PM
                    Wow, definitely a strange one! Is there any javascript involved at this point? My initial troubleshooting steps are always to shut off CSS and Javascript so that I have nothing but html. Have you given this a try?

                    I didn't try turning off CSS and Js but these are often good steps to take.

                    Quote from: jaredloman at Mar 12, 2014, 11:19 PM
                    I'm not entirely familiar with the mechanics of Incognito Mode in chrome but if I remember correctly, cookies aren't saved, data isn't cached, history isn't stored, and sessions are reset on each page refresh.

                    My other little learning out of this was that Incognito Mode is a useful way to test if you don't want to fire up another browser.
                      David Walker
                      Principal, Shorewalker DMS
                      Phone: 03 8899 7790
                      Mobile: 0407 133 020