We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49539
    • 1 Posts
    Hi guys. First off, I'd like to apologize for my poor search skills. I didn't know how to phrase this question in google to see find results (because I know I'm not the firs to ask!) I'm throwing together a website with some hackneyed knowledge of HTML and CSS utilizing modx.

    What I'm doing is really generating a single line of text in a Template variable pulled randomly from a subfolder of resources. I am able to make it pick one at random on page load. I have a "reload" button but that really just refreshes the page. I'd love to be able to have my page generate new text on a click of a button.


    I'm not very well versed in javascript/php. I've been looking at code so far and modifying it, which lets me learn a little at a time. I really appreciate all of your help!
      • 4172
      • 5,888 Posts
      you can try getResources

      [[!getResources?
      &parents=`yourContainerID`
      &tpl=`@INLINE [[+pagetitle]]`
      &sortby=`RAND()`
      &outputSeparator=`,`
      &limit=`10`
      ]]


      If this words doesn't need to be resources, but just some words, which you want to output randomly, you could try it with a MIGX - TV
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!