Looping images into table for gallery?
Posted: Fri Nov 19, 2004 5:33 am
Hi All,
Does anyone know a good way of looping 12 images into a table that is 3 columns x 4 rows?
I was thinking of setting up an outer loop for the rows and an inner loop for the columns. Something like:
This looks like it could get pretty messy. Is there an easier way out there of doing this?
Brad.
Does anyone know a good way of looping 12 images into a table that is 3 columns x 4 rows?
I was thinking of setting up an outer loop for the rows and an inner loop for the columns. Something like:
Code: Select all
echo "<table>\n";
//Row Setup
for ( $y = 1; $y <=4; $y++ ) {
echo " <tr>\n";
//Column Setup
for ( $x = 1; $x <=3; $x++ ) {
echo "<td>\n";
//Image gets put here
echo "</td>\n";
}
echo " </tr>\n";
}
echo "</table>\n";Brad.