[Radiant] any way to dynamically populate <r:random>?

john muhl lists at johnmuhl.com
Sat Jun 7 18:46:21 CDT 2008


On 2008/06/07, at 16:49, Andrew Neil wrote:

> On 6 Jun 2008, at 01:01, john muhl wrote:
>
>> I'd like to insert part of a random subpage into the sidebar and  
>> figured it'd be a good fit for the <r:random> tag but so far am  
>> having very little luck. I've tried:
>>
>> <r:random>
>> <r:children:each>
>>   <r:option><r:title/></r:option>
>> </r:children:each>
>> </r:random>
>
> I thought of an alternative approach which might be easier to  
> implement. Here is an example:
>
> <r:find url="/quotations">
>  <r:children:each limit="1" order="rand">
>      <r:content part="body"/>
>  </r:children:each>
> </r:find>
>
> This doesn't work at the moment, because the order attribute can  
> only be asc or desc. I think it would be pretty easy to add the  
> option for random order though.

I was going to try putting together a patch to add "rand" as an order  
option, but as far as I can tell the "ASC" and "DESC" ordering is part  
of ActiveRecord and that seems like the wrong place to apply a patch  
for Radiant. Am I way off base here or are the ordering options, in  
fact, part of ActiveRecord?


More information about the Radiant mailing list