#933 - Ordering specification for main_image_fader block

This is a spacer post for a website comment topic. The content this topic relates to: #933 - Ordering specification for main_image_fader block
Actually I have just looked at the code again and you CAN do ordering already.

It's not the same as the other blocks, as the use case for fading is rather different. For other blocks you may well show e.g. 80 results, so you say the order you want those results to flow out.

For this, you are likely to pick out just a small handful of things to fade, and want explicit control of what they are. So you give a parameter that says the explicit order.
An example:
order="i2,i10,v3,i9"
This shows image 2, then image 10, then video 3, then image 9.

If you want randomised orders, you could kind of fake that a bit using Tempcode...
{$BLOCK,block=main_image_fader,order={$SET_RAND,i2\,i10\,v3\,i9,i6\,i1\,v6\,i2,...}}
I realise that's not the nicest syntax in the world, but I've defined two possible orders there, and the Tempcode SET_RAND symbol will randomise which to pick. ",..." is there for illustration, to show you can make as many as you want -- obviously real code should not include that bit.

Or, you can use the ORDER BY rand() hack temp1024 gave you. That hack won't stop manual ordering working for the case where the 'order' parameter is passed, assuming you have less than 100 images and videos.


I realised you have sponsored this Sholzy, maybe change it to zero and hold the credits or move elsewhere?

0 guests and 0 members have recently viewed this.