Hi guys,
Does anyone know how to achieve a random quote of the day with getresources or a similar snipped in MODX 2? The ideal solution will be to have the snippet read random paragraphs from a document or a file on the server.
Thanks for your help
A MODx Fanatic
getResources will do easily it if each quotation is a separate document, but that’s fairly wasteful.
If you’re interested in writing your own, you might take a look at the EZfaq snippet, which parses a single document with Q: and A: prefixes for each part. You could easily use Q: for the quotation and A: for the author and select one at random with array_rand($docArray) and return it (after removing the extraneous code from the snippet).
There’s also a snippet or two on the forums that does random quotations, but I believe that they all require each quotation to be a separate document, like getResources.