« Comparison of Object Oriented Philosophy - Python, Java, C++, Perl | Main | Old Wardour Castle »
August 14, 2006
Displaying data at 5 items per line on a web page
If you want to display a list of items in (say) 5 columns on a web page, use a table. A loop in PHP will let you generate all the table cells very easily, then add in a little extra code to deal with:
a) The very first cell (you need to open table and row)
b) Every fifth cell (you need to start a new row) and
c) The very last cell (you need to pad out the last row and close the table).
Like an example?
Working demonstration here
Source code here
Posted by gje at August 14, 2006 05:27 AM