Sat, 2003-11-08 12:10
I want to define a template where div's define rows with 3 images. the number of rows therefore depends on the number of images.
something like this
-------
img1 img2 img3
-------
img4 img5 img6
-------
img7 img8 imgx
-------
Has anyone an idea?
cheers,
Mark
Sun, 2003-11-09 19:56
#1
template php-css
Hey is this of any use to ya..? (It's missing most of the surrounding HTML/XHTML mark-up but..
<?php $num_images = 9; $n = 0; while ($n < $num_images) { echo "<div>\n"; for ($i = 0; ( $i < 3 ) && ( $n < $num_images ); $i++ ) { $n++; echo " <img src=\"image_$n.gif\" alt=\"image\" />\n"; } echo "</div>\n"; } ?>
That will give something like..
<div> <img src="image_1.gif" alt="image 1" /> <img src="image_2.gif" alt="image 2" /> <img src="image_3.gif" alt="image 3" /> </div> <div> <img src="image_4.gif" alt="image 4" /> <img src="image_5.gif" alt="image 5" /> <img src="image_6.gif" alt="image 6" /> </div> <div> <img src="image_7.gif" alt="image 7" /> <img src="image_8.gif" alt="image 8" /> <img src="image_9.gif" alt="image 9" /> </div>
Tue, 2003-11-18 10:30
#2
template php-css
You could always just apply an appropriate margin to the images, and let them just run across the page as per usual. If you need to restrict the number of images that fit across before wrapping, you could enclose the images in a fixed-size div...
Did that make sense? :roll: