[Radiant] <r:random> and page children
Dave Crossland
dave at lab6.com
Thu Sep 14 15:32:23 CDT 2006
On 14/09/06, Sean Cribbs <seancribbs at gmail.com> wrote:
> I've been following this thread, but haven't replied yet. The problem may
> be a tag scoping issue, and maybe a custom tag is in need here.
>
> tag "children:random" do |tag|
> children = tag.locals.children
> if children.size > 0
> index = rand(children.size)
> tag.locals.page = children[index]
> tag.expand
> end
> end
>
> Then in your page, write
>
> <r:children:random /><r:title /></r:children:random>
>
> or just
> <r:children:random:title />
>
> This will only select one child page, mind you, and would need to be
> modified to select more than one.
I've added this to the wiki at
http://dev.radiantcms.org/radiant/wiki/HowToDefineGlobalTags
--
Regards,
Dave
More information about the Radiant
mailing list