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

    I want to use Ditto to display one random "quote" from a selection of several quotes in a folder (e.g. the documents contain one quote each).

    I tried using the code below, but this is only showing the contents of the most recently created document, and it does not change.

    [[Ditto?parents=`217`&depth=`2`&tpl=`DittoQuotes`&display=`1`&randomize='1'&filter=`isfolder,0`]]


    How can I randomise the quote which is displayed?

    Thanks for your help!
    Matt
      • 19667
      • 26 Posts
      How can I randomise the quote which is displayed?
      Use backticks smiley

      &randomize=`1`
      


      Edit:
      And if you want to exclude folders,  your filter should look like that
      &filter=`isfolder,1,2`


      http://ditto.modxcms.com/tutorials/basic_filtering.html
        • 20557
        • 43 Posts
        Thanks! I should have spotted that smiley

        I also discovered that I needed to call Ditto in uncached mode for it to work:
        [!Ditto?parents=`217`&depth=`2`&tpl=`DittoQuotes`&display=`1`&randomize=`1`!]


        Thanks again,
        Matt
          • 19667
          • 26 Posts
          Quote from: mtheuma at Apr 02, 2009, 01:36 PM

          I also discovered that I needed to call Ditto in uncached mode for it to work again
          yes. you’re right. just tested it with/on (no grammar knowledge here) a(n) unpublished page. and unpublished pages don’ t care for cache settings.