We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29181
    • 480 Posts
    Hey,
    I thought the randomize parameter was meant to generate a random result,but this returns the same item everytime. I turned off page cahcing thinking maybe this was the issue, but without success. If I remove display=`1` it returns 3 results.

    [!Ditto?&parents=`0` &randomize=´1´ &extenders=`summary` &truncLen=`520` &truncOffset=`15` &id=`content` &depth=`0` &tpl=`contentTpl` &filter=`displayPageContent,[*newsEvents*] ,1` &display=`1`!]

    According to the ditto docs:


    Purpose
    Randomize the order of the output

    Options
    0 off
    1 on Any MODx field or TV for weighted random
    Default
    0 off

    Can anyone tell me what "Any MODx field or TV for weighted random" means, and how to make the snippet return a random result, if the options are 0 or 1 I can’t set it to pagetitle.

    Hopefully someone can point me in the right direction.
    Taff
      Adrian Lawley: www.adrianlawley.com
      • 36582
      • 463 Posts
      HI Taff,

      My perception of this is that it randomises the order of results and not the actual results.

      By default I think Ditto returns 3 results if you don’t specify.

      I think something like RandomAd will return 1 result at random?
        Web site design in Nottingham UK by Chris Fickling http://www.chrisficklingdesign.co.uk
        • 36592
        • 970 Posts
        How is the result when you delete &filter parameter ?
          • 29181
          • 480 Posts
          Removing the filter, displays the same item all the time. Removing the display=1 displays the same 3 items all the time, in the exact same order.

            Adrian Lawley: www.adrianlawley.com
            • 36592
            • 970 Posts
            &randomize=´1´

            You should use backticks.
              • 7231
              • 4,205 Posts
              I am sure that this is a typo but you have single quotes in your randomize declaration:
              you have &randomize=´1´ it should be &randomize=`1` grin

              TKFM beat me to it...
                [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]
                • 29181
                • 480 Posts
                Thanks!

                You would not believe how many times I have been through that. The ` and ´ are both on the same key with a German keyboard and both require further input to display.

                This is sooo embarrassing. The number of times I have seen posts where the solution has been to display the ticks...and I missed ’em. I’ll try and type more precisely now

                I hang my head in shame and salute you both for noticing something I should have seen a long time back.



                Taff
                  Adrian Lawley: www.adrianlawley.com