[Radiant] <r:random> and page children

Sean Cribbs seancribbs at gmail.com
Thu Sep 14 15:34:46 CDT 2006


FYI Peek at the weblog... http://radiantcms.org/blog/

Sean Cribbs
seancribbs.com

On 9/14/06, Dave Crossland <dave at lab6.com> wrote:
>
> 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
> _______________________________________________
> Radiant mailing list
> Post:   Radiant at lists.radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.radiantcms.org/pipermail/radiant/attachments/20060914/c420edb2/attachment.html


More information about the Radiant mailing list