Noughts and Crosses layout with a variable number of entries

I have a product listing of 9 per-page. The products on the far right
and bottom row should NOT have a border on the aforementioned sides. So,
similar to a noughts and crosses layout. However, pages do not always
have 9 products to display.

You may have a better understanding if you see the code I'm currently
using: http://pastie.org/1223260

The code above is passed inside a block and executed on each product in
the products array.

I cannot get the specified lines to disappear or wrap my head around
this. I would *really* appreciate assistance with this.

If you need more information, please reply with what you need to help
me.

That seems complicated as hell… Why not just make divs for the "rows" and in that divs for the "cells", and only output those divs as needed (yes, you already only output divs as needed, but the branching seems "too much"). Then try to find out what row or what cell adds which line. E.g. the second cell should have a left border to separate it from the first cell, same thing for the third cell. If you then have a fourth cell, you begin the second row, which then should have a top border to separate it from the first row, and so on.

Thinking of it, the rule would be simple: output a div per product, group those in divs of 3 (the "rows"), mark the first "row" and the first "cell" of each "row" with a special class, and style every cell but the first of each row to have a left border, style each row but the first to have a top border.

(oh, and you have style stuff in class attributes, and you shouldn't have style stuff in your view in the first place, use classes and css.)

Best,

Felix

Apologies for omitting the code you provided - I needed to reduce the
number of quoted lines.

Thanks very much, I'll give that a try. I should've considered the
in_groups_of method before.

I've actually hacked something together that seems to have worked. I'll
report back with my results.

Pale Horse wrote in post #951715:

Apologies for omitting the code you provided - I needed to reduce the
number of quoted lines.

Thanks very much, I'll give that a try. I should've considered the
in_groups_of method before.

Bah, my last_col_pos calc is wrong... rather than group.length-1, try
group.nitems-1 Taht should ignore any nils added if there aren't 3
items in a group