Forums / General / Shuffle in ezpublish4.0

Shuffle in ezpublish4.0

Author Message

John Smith

Wednesday 16 April 2008 3:09:20 am

What is best method to andomly display images from a folder in ezpublish 4.0.

In ezpublish3.6.1 we use to use "shuffle"..

Cheers.

André R.

Wednesday 16 April 2008 3:21:33 am

Like before, the best way is to fetch the image count with list_count or tree_count.
Then generate a random number between 0 and count -1, and fetch the image with the random number as offset and limit = 1 using list of tree fetch(depending on what you used to get image count).

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

John Smith

Wednesday 16 April 2008 5:51:55 am

Thanks Andre for your kind help.

One thing, here I want to display 3 images, if in the folder the images are more than 3 then they will rotate/shuffle .

Any clue?

Mark Marsiglio

Wednesday 16 April 2008 6:01:36 am

We have updated the shuffle operator extension for use with 4.0. I will see if we can get it packaged up and uploaded.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

John Smith

Wednesday 16 April 2008 6:06:54 am

That might help, thanks, please post when done....

Mark Marsiglio

Wednesday 16 April 2008 6:56:08 am

http://ez.no/developer/contribs/template_plugins/shuffle_4_0

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

John Smith

Wednesday 16 April 2008 7:01:55 am

Hi Mark,

Thanks for your kind help and uploading the contribution, would it be possible to have some idea what changes you made to make it work on ezpublish4.0.

I am in the process of upgrading few sites from 3.6.0 to 4.0.

It might help....

Mark Marsiglio

Wednesday 16 April 2008 7:19:56 am

In this particular extension, the upgrade was a matter of removing a single "&" from the existing code.

Other extensions that we have had to upgrade for 4.0 took significantly more time.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions