Maybe using something like:

<r:children>
  <r:each order="desc" limit="1" offset="0">
  ...
  </r:each>
  <r:each order="desc" limit="3" offset="1">
  ...
  </r:each>
  <r:each order="desc" limit="1" offset="4">
  ...
  </r:each>
</r:children>

    In this case <r:each> should return an empty list in the last case.

    /AITOR


On Nov 23, 2007 1:20 PM, Andrew Neil <[EMAIL PROTECTED]> wrote:

> Hi,
>
> On one of my sites, I'm using the following snippet:
>
> <r:children>
>
>   <r:first order="desc">
>     <div class="entry firstentry">
>       <r:snippet name="entry"/>
>     </div>
>   </r:first>
>
>   <r:each order="desc" limit="3" offset="1">
>     <div class="entry">
>       <r:snippet name="entry"/>
>     </div>
>   </r:each>
>
>   <r:last order="desc" limit="5">
>     <div class="entry lastentry">
>       <r:snippet name="entry"/>
>     </div>
>   </r:last>
>
> </r:children>
>
> The idea is that it should list the 5 most recent entries (child
> pages), wrapping each in a div.entry, except adding
> class="firstentry" or "lastentry" to the first and last. I need these
> extra handles for the sake of CSS styling, which differs on first/
> last from middle entries.
>
> The snippet above works fine, except when I have less than 5 child
> pages. In that case, the final entry is listed twice. This won't be a
> problem in the future, when the site grows, but it is an irritation
> at this early stage where some of the pages calling this snippet have
> less than 5 pages. I wonder if anyone can suggest an improvement?
>
> Thanks,
>
> Drew
> _______________________________________________
> Radiant mailing list
> Post:   [email protected]
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to