2

I would like to use a parameter like orderby="random" on a matrix field to randomize the order of the row output.

{matrix_field orderby="random"}
  {row_title}
{/matrix_field}

I tried this, but got a MySQL error. Is this possible?

  • What type of mysql error did you get? – Romans-8---31-39 May 21 '13 at 21:50
  • Without testing I'm quite sure this is correct. What error are you getting? – Paul Redmond May 21 '13 at 21:51
  • MySQL error was Unknown column 'random' in 'order clause' because you can't set random via the orderby parameter. The answer below is correct! – Jon Horton May 22 '13 at 13:11
8

You actually have to do sort="random" in Matrix. It's not like channel:entries in that way.

  • I just looked it up a minute ago and could have sworn I saw it under orderby as well as sort. Either the docs just changed or I'm seeing double: voting for the latter. – Romans-8---31-39 May 21 '13 at 22:17
  • Yeah, the old docs used to have all this info and more, but the new ones are sorely lacking :( Thanks for the help! – Jon Horton May 22 '13 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.