Here's the psuedocode for this:
Note that if you have a number of zones that doesn't divide evenly into the columns, the final column will contain a number of empty lines at the end, making it match the other cells in height.
There's probably a more elegant way to do it that doesn't involve using three counters and two loops, but this should work.
Code:
NumColumns = 4; while (data = getDBdata) { Format data to have proper link and assign it to data_with_link MyArray[] = data_with_link } NumZones = count(MyArray); NumZonesPerColumn = NumZones / NumColumns; If NumZonesPerColumn > int(NumZonesPerColumn) { // this deals with the fractional part NumZonesPerColumn = int(NumZonesPerColumn) + 1; } ZoneCounter = 0; start table. for (ColumnCounter = 1 to NumColumns) { print "<td>" for (counter = 1 to NumZonesPerColumn) { print MyArray[ZoneCounter] . "<br>"; ZoneCounter++ } print "</td>" } end table.
There's probably a more elegant way to do it that doesn't involve using three counters and two loops, but this should work.
Comment