PHP Question

I need an ordered 6 automated div css boxes which looks like Facebook photo album

I need a div css boxes every time with html-php content, when its in one row 6 pieces of boxes exist automated starts under and again 6 boxes and goes on what I exactly mean is a behaivour like in facebook album just the difference facebook has 4 Photos for every row i need six and not photos but a just div css boxes which will contain *.php files and will be produced through a form in same page, for example i give in form name John Doe in one box and Bill Clinton in second box and so on.

here is my try

<div class="header">
$dir= opendir(".") or die ('Cannot open directory');
$div="<div class=\"left1\">\n";
echo "<div class=\"wrapper\">\n";
for( $i=0; $i<6; $i++){
while(($file = readdir($dir)) != false){
if(preg_match("/php$/", $file)){
echo $div;
echo "</div>\n";
echo "</div>\n";


but it doesn't work as I wish.

Answer Source

Just do the following :


for($j=1; $j < 13; $j++) : 

print '<div style="float:left;width:100px">';

    print 'your content here for the div. change width and loop numbers as needed';

print '</div>';

//magic is here
if($j%6==0) print '<div style="clear:both;"></div>';

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download