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

    This should have been an easy one, but for some reason the following is not working.

    In a template for the homepage, I have several ditto calls. Two of them are set on randomize, these are the calls:

    [!Ditto? &parents=`2` &orderBy=`pub_date DESC` &summarize=`20` &total=`5` &randomize=`1` &tpl=`home_image_fma`!]


    The other is the same, but then for parent no. 3
    The tpl fetches the images from those documents, so I should get a nice image randomizer. Tried lots of options and did a thorough search. Instead I get the same result every time instead of random. Someone here with a fresh eye what I could be doing wrong?

    Thanks much in advance,
    Paintbox

    On modx 1.0.2.
      • 23183
      • 102 Posts
      I think it might be because you have set &orderBy=`pub_date DESC` I dont think you should have an orderBy if you want it to be random.
        • 22586
        • 74 Posts
        I removed that portion, also checked that the page is not cached. Very weird.

        Anyone else ran into the same problem? Tried it out?
          • 16278
          • 928 Posts
          I copied and pasted your Ditto call, adjusting the &parents parameter and using &tpl=`@CODE:Hi! I’m document[+id+]
          `
          as template. It worked nice and randomly for me. I also tried repeating the call in the same page with a different parent. Worked randomly on both instances, against my expectations - I thought you might be in need of an &id parameter to keep the Ditto results out of each other’s hair.

          Perhaps if you try a simple template like mine, you’ll be able to see if the problem lies with the template rather than the Ditto call?
          smiley KP
            • 22586
            • 74 Posts
            I tried that (copy and pasting resulted in error btw) then removed the tpl completely and still I get the results which seems to be sorted by menu index, instead of randomization.

            I removed the other Ditto call I had going as well, to rule out any entanglement.

            I have been checking the software on the server:
            MySQL 5.0.51a
            Php 5.2.12

            Seems to be the latest version of them. Just so I am not missing anything, these results should refresh each new page visit right?

            For another client I am going to install a fresh new modx, going to see if it makes a difference...

            I know I could probably use a snippet that does something like this, but I’d rather use this out of the box...

              • 26931
              • 2,314 Posts
                • 22586
                • 74 Posts
                Dang. I immediately sent a mail to my hoster about this problem. Let’s hope this solves it.

                Thanks!
                  • 22586
                  • 74 Posts
                  My hoster upgraded mySQL and randomize is working perfectly now.

                  Thanks Sharkbait and everyone who chipped in!