2

I'm trying to randomise a background image from one of my Assets folders but the limit parameter doesn't seem to be working correctly on the {exp:assets:files} tag.

Code:

{exp:assets:files folder_id="16" limit="1" sort="random"}{url}{/exp:assets:files}

The above code gets the correct folder but all 3 images are begin output instead of just one. The docs suggest that you can add the limit parameter to this tag and further searching on the get satisfaction showed that the sort="random" parameter was also supported.

I have tried the same code but changing the limit to something higher than 1 and still no success. Also tried the tag pair with out the sort="random" parameter.

I'm using Assets 2.0.1 and EECMS 2.5.3

What can I do to get these randomised?

Thanks Dan.

2

Currently sort="random" is limited to the fieldtype tags. We’ll add support for sort="random" to {exp:assets:files} and {exp:assets:folders} in Assets 2.1.

1
  • Thanks Brandon. I will use some JS to sort them randomly then. Might still want to check the limit though as even without the sort param it still piped out all images in the folder.
    – since1976
    Jan 19 '13 at 5:25

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.