Forums / Developer / sort_by rand()
Caroline Condamin
Tuesday 13 January 2009 7:51:17 am
Hi,
In a template, I have a list retrieved with this code:
def $my_list = fetch( content, list, hash( parent_node_id, 2810, class_filter_type, "include", class_filter_array, array(141)))
I want to sort this list by a random way.
I've tried:
sort_by , array('rand()', true())
, but it does not work.
Is there somebody who has a solution?
Thanks!!
Ciji
Christophe Condomines
Tuesday 13 January 2009 11:56:06 am
Check this:
http://ez.no/developer/contribs/template_plugins/shuffle_4_0
Microblau SL http://www.microblau.net
Wednesday 14 January 2009 8:36:30 am
Great,
Thanks! This solution solves the first part of my problem.
The second one is that I need to generate a new random array each time I refresh my page... but now I have a problem of cache! Somebody has already posted a topic here :
http://ez.no/developer/forum/developer/shuffle_and_cache_please_help
I'm gonna follow this discussion.
Thanks a lot for your help Christophe.
Ciji.