This is going to be difficult for me to describe, but here's what I'm after.
I've created a TV in modx called AnchVar. Input type = Text.
Here's the kind of data I will be entering into this TV
Textstring1||Textstring2||Textstring3||Textstring4||Textstring5
Now here's what I don't know how to do... I understand how to output delimited text (output type = delimiter, set whatever delimiter I wish), but what I want is for Modx to randomly output ONE of those text strings... so if I'm running this uncached my page will show one time
Textstring1
and the next time maybe
Textstring5
I want ONE of the text strings I enter in the Text TV randomly selected and outputted (can I say that?).
Can anyone give me a pointer in the direction of how I would go about doing this?
I was thinking getResources, but I could only ever get it to output the entire string, not one of the delimited strings.
Please help!
-
☆ A M B ☆
- 24,524 Posts
Use MIGx. its default output snippet, getImageList, can display random items.
I came across get image list but was under the impression it only output images but I will give it a second look.
-
☆ A M B ☆
- 24,524 Posts
It is the provided listing snippet for MIGx. There are a lot of naming conventions in MIGx that are holdovers from its original purpose. Basically what it does is parse the MIGx JSON strings and put the individual items into placeholders so you can use them in a tpl like any other listing snippet (Wayfinder, getResources).