The principle is similar to zebra-striping a table, but it's not exactly the same thing, so I've had a tough time finding a solution / thinking about the way to do this.
I am trying to alternate the number of columns per row. Every odd row will have 4 columns and every even row will have 3.
If my query returns 11 records, I'd like to:
- Output the first four into 1 row, 4 columns
- The next three into 1 row, 3 columns
- The last four into 1 row, 4 columns
I posted a sample array and markup on phpfiddle to help illustrate my goal: http://phpfiddle.org/main/code/h9r-hj1
Any help is appreciated!
Tested and working. Newlines can be relocated as per your needs.
http://codepad.org/O1BFebhC