We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22815
    • 1,097 Posts
    This is an auto-generated support/comment thread for RandomTV.

    Use this forum to post any comments about this addition or any questions you have regarding its use.

    Brief Description:
    Randomly displays one option from a multi-select TV.
      No, I don't know what OpenGeek's saying half the time either.
      MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
      Forum: Where to post threads about add-ons | Forum Rules
      Like MODx? donate (and/or share your resources)
      Like me? See my Amazon wishlist
      MODx "Most Promising CMS" - so appropriate!
      • 31654
      • 238 Posts
      How would I use this to display a random quote?
      I’ve seen the other randon quote but it uses very dirty code!

      I would like it to disply a random chuck if possible?!?!
        Web Development, Web Hosting & Search Engine Marketing by:

        Vitalized | UK
        w. www.vitalized.co.uk

        Website Design | Search Engine Marketing (SEM) | UK MODx web hosting, secure, fast & 100% MODx compatible

        Vitalized | Australia
        w. www.vitalized-australia.com.au

        Website Design | Search Engine Marketing (SEM) | Australian MODx web hosting, secure, fast & 100% MODx compatible
        • 6726
        • 7,075 Posts
        Nice snippet smiley
        I can imagine a few ways to use it !

          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l'outil id
          • 2136
          • 134 Posts
          hi,

          thanks for making this cool snippet. i’m not able to get it to do anything random - it just displays the selected option. what i’ve done:

          1. made a snippet called RandomTV & inserted the snippet code
          2. created a multiselect TV called ’webRandom,’ and have tried a multiselect listbox, radio options & checkbox, with & without default values, with & without a widget (delimited list using ’,’ or ’
          ’)
          3. put the following into the template: [[RandomTV?tv_name=webRandom]]

          the purpose is to randomly select between banners (which have links). the caveat is that this is the 3rd time i’ve made a TV, so i’m sure some user error is involved. (the other 2 are working fine, one for putting some variable text into a template’s html, the other to select between one of 3 chunks of html). can anyone provide an example of how this should work?

          thank you.
            Sorry - not using ModX anymore 01/01/2007
            • 727
            • 502 Posts
            I haven’t tried this snippet but what about creating a drop down list TV with something like the following for the value:

            foo=={{chunk1}}||bar=={{chunk2}}


            Andy
              • 2136
              • 134 Posts
              nope - same result. the directions are pretty generic: ’Create a multi-select TV.’ so any of the options i’ve tried, including your suggestion, should work. thanks for the suggestion tho.

              has anyone got this to work?
                Sorry - not using ModX anymore 01/01/2007
                • 26016
                • 561 Posts
                I just got this little thing to work!

                Like the person in the previous post must have done, I do my share of swearing at the documentation or lack thereof. And I know, I know, it’s free software so I can’t complain. But I will reserve my right to be annoyed! It’s like having a relative who has certain annoying personality traits, but you love them anyway because they’re super-creative, or very generous, or what-have-you. smiley

                And I’ll readily confess, I don’t like doing support either, which is why I’ve actually held back on publishing some tricky stuff I’ve done. In any case, maybe somebody will be helped by this....

                I simply wanted to use this to display random images. I set up my TV, made it a Listbox (Multi-Select), and added Input Option Values (all image locations) separated by "||", all very normal stuff. And then make your TV available to the template you’ll be using. But no one ever mentions that, because of course EVERYbody should know that already. wink

                Then I set up my snippet, and made the call in my document. And got absolutely nothing, of course!

                Then I edited my document, and actually selected one of the items in the list box. And then I got something! But it was always the one that I selected, of course! Then I was unable to unselect it, even if I set and reset the TV’s availability to my template, probably due to caching or something, so I had to delete the document and make a new one.

                Then finally, the Magic Key... it wasn’t enough to have "Input Option Values"... I had to put all of those same values into "Default Values" (minus fieldnames, because they didn’t work here!), again separated by "||". And boom, the thing finally worked. btw, it also worked with DropDown List Menu as Input Type. I’m calling the snippet uncached to make sure, although in the tiny instructions this is not done.

                And I’m guessing that a similar thing could be done using some chunks as options, and that could be all kinds of fun! And of course, some will try what I’m suggesting above, and will get absolutely nothing! But there’s always hope! smiley
                  MODx and Wordpress development
                  Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4