[Radiant] Zebra striping using <r:children:each>?

Sean Cribbs seancribbs at gmail.com
Wed Oct 18 10:56:18 CDT 2006


What if I wanted three colors?  There's got to be a generalized way to do
this, and one that doesn't mangle r:children:each (which is complex
enough!).  I'm thinking something like the way r:random works.

I'll take a look at your code.  I'm pretty busy today, but I may have a "How
To" up my sleeve for this one.

Sean Cribbs
seancribbs.com -- comments on my site are down because I was too lazy to get
Akismet before it was too late

On 10/18/06, Jacques Marneweck <jacques at powertrip.co.za> wrote:
>
>  John W. Long wrote:
>
> Nathan Donaldson wrote:
>
>  I've come up with something. Nice or not I'll let you decide :-)
>
> Open to suggestions for changing names of tags.
>
> It's simplicity itself at the moment,
>
> <r:children:each order="desc" reset_cycle="false"> to carry on from the
> last row otherwise it will reset to zero so that the first row is "odd"
>
> <r:cycle_row /> to output "even" or "odd"
>
>  Perhaps it would be better to have two tags:
>
>    <r:even>...</r:even>
>    <r:odd>...</r:odd>
>
>  Smarty allows you to cycle stuff while in a loop:
>
> {section name=i loop=$items}
>   <tr bgcolor="#{cycle values="ffffff,dedede"}">
>     <td>{$items[i].field}</td>
>     <td>{$items[i].field}</td>
>     ...
>     <td>{$items[i].field}</td>
>   </tr>
> {/section}
>
> Type thing.
>
> Regards
> --jm
>
> which only render their contents when the index is even or odd? We
> should probably also add an <r:index /> tag that returns the number.
>
> --
> John
>
>  --
> Jacques Marneweck
> http://www.powertrip.co.za/http://www.powertrip.co.za/blog/
>
> #include <std/disclaimer.h>
>
>
> _______________________________________________
> 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/20061018/4cafa7c4/attachment.html


More information about the Radiant mailing list