Page 1 of 1

Arranging Images

Posted: Tue Apr 15, 2003 11:07 pm
by Deacon Pie
I want to arrange images so that I can place two across, and then to the next line. The image information is going to be gathered from a database, and basically I need a new <tr> every two images.

Anyone have any ideas on how to work this one out?

Posted: Tue Apr 15, 2003 11:56 pm
by volka
you can use the modulus operator to seperate "even/odd" entries.
e.g.

Code: Select all

<html><body>
	<pre>
<?php
$dummy = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h');
$i = 0;
foreach($dummy as $d)
{
	if ($i++ % 2 == 0)
		echo "--break--\n";
	echo $d, "\n";
}
?>
	</pre>
</body></html>